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-24 17:40:45 +0300
commit8164acebd7adfd3cc3e80f9750a4ce88e28399ce (patch)
treeb582a35ca80fd80f3a00816a7aaeb76d4f57c788
parentaec639d33b404ed4e1e587ea181cd65af5e5314e (diff)
downloadgitlab-ci-8164acebd7adfd3cc3e80f9750a4ce88e28399ce.tar.gz
warning when .gitlab-ci.yml not found
-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.rb19
5 files changed, 26 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5994671..78e9002 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@ v7.13.0
- Ability to cancel all builds in commit at once
- 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 76b491f..b1b586c 100644
--- a/app/views/commits/show.html.haml
+++ b/app/views/commits/show.html.haml
@@ -45,6 +45,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 e63d844..a30b00d 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -27,6 +27,25 @@ describe "Commits" do
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