summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-24 17:38:13 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-25 10:03:04 +0300
commit60681251ffa70bba1c8f7288907b5696d3688962 (patch)
treeacd15cb6ad57cd150f210d236a533911c76217fa
parenta0ee84d89bfac547f92fee72854f326f9ce74145 (diff)
downloadgitlab-ci-60681251ffa70bba1c8f7288907b5696d3688962.tar.gz
warning when .gitlab-ci.yml not found
Conflicts: spec/features/commits_spec.rb
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/commit.rb2
-rw-r--r--app/services/create_commit_service.rb3
-rw-r--r--app/views/commits/show.html.haml4
-rw-r--r--spec/features/commits_spec.rb28
5 files changed, 35 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 18ea771..2a3e545 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@ v7.13.0
- Update web hook example
- Improved Lint stability
- Add one more validation rule for .gitlab-ci.yml
+ - Add warning when .gitlab-ci.yml not found
v7.12.1
- Runner without tag should pick builds without tag only
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 46900ab..215afdd 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -215,7 +215,7 @@ class Commit < ActiveRecord::Base
end
def config_processor
- @config_processor ||= GitlabCiYamlProcessor.new(push_data[:ci_yaml_file])
+ @config_processor ||= GitlabCiYamlProcessor.new(push_data[:ci_yaml_file] || project.generated_yaml_config)
end
def skip_ci?
diff --git a/app/services/create_commit_service.rb b/app/services/create_commit_service.rb
index df678d4..f9d16a5 100644
--- a/app/services/create_commit_service.rb
+++ b/app/services/create_commit_service.rb
@@ -3,7 +3,6 @@ class CreateCommitService
before_sha = params[:before]
sha = params[:checkout_sha] || params[:after]
origin_ref = params[:ref]
- yaml_config = params[:ci_yaml_file] || project.generated_yaml_config
unless origin_ref && sha.present?
return false
@@ -34,7 +33,7 @@ class CreateCommitService
repository: params[:repository],
commits: params[:commits],
total_commits_count: params[:total_commits_count],
- ci_yaml_file: yaml_config
+ ci_yaml_file: params[:ci_yaml_file]
}
}
diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml
index 9ca6222..47ec006 100644
--- a/app/views/commits/show.html.haml
+++ b/app/views/commits/show.html.haml
@@ -39,6 +39,10 @@
%ul
- @commit.yaml_errors.split(",").each do |error|
%li= error
+
+- unless @commit.push_data[:ci_yaml_file]
+ .bs-callout.bs-callout-warning
+ \.gitlab-ci.yml not found in this commit
%h3 Status
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb
index deaf729..a30b00d 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -18,6 +18,34 @@ describe "Commits" do
it { page.should have_content @commit.git_commit_message }
it { page.should have_content @commit.git_author_name }
end
+
+ describe "Cancel commit" do
+ it "cancels commit" do
+ visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
+ click_on "Cancel"
+
+ page.should have_content "canceled"
+ end
+ end
+
+ describe ".gitlab-ci.yml not found warning" do
+ it "does not show warning" do
+ visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
+ click_on "Cancel"
+
+ page.should_not have_content ".gitlab-ci.yml not found in this commit"
+ end
+
+ it "shows warning" do
+ @commit.push_data[:ci_yaml_file] = nil
+ @commit.save
+
+ visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
+ click_on "Cancel"
+
+ page.should have_content ".gitlab-ci.yml not found in this commit"
+ end
+ end
end
context "Public pages" do