summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-07-04 03:08:30 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-07-04 03:08:30 +0800
commit63bf2457e40ffd465d9a5aeee9b26b1c82432f9d (patch)
treec9733e297dbf0500ffb1de8b511eb52fa9c66c45 /app
parentd7c32c5870ff7122122d0fc75ed8a04a0818251e (diff)
downloadgitlab-ce-63bf2457e40ffd465d9a5aeee9b26b1c82432f9d.tar.gz
Follow feedback on the merge request
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/pipeline.rb16
-rw-r--r--app/models/project.rb8
-rw-r--r--app/models/repository.rb4
3 files changed, 14 insertions, 14 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 6905ab9ea23..a38c63e9e91 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -330,10 +330,10 @@ module Ci
return @ci_yaml_file if defined?(@ci_yaml_file)
@ci_yaml_file = begin
- project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path)
- rescue
+ project.repository.gitlab_ci_yml_for(sha)
+ rescue Rugged::ReferenceError, GRPC::NotFound
self.yaml_errors =
- "Failed to load CI/CD config file at #{ci_yaml_file_path}"
+ "Failed to load CI/CD config file at #{project.ci_config_file_for_pipeline}"
nil
end
end
@@ -342,14 +342,6 @@ module Ci
yaml_errors.present?
end
- def ci_yaml_file_path
- if project.ci_config_file.blank?
- '.gitlab-ci.yml'
- else
- project.ci_config_file
- end
- end
-
def environments
builds.where.not(environment: nil).success.pluck(:environment).uniq
end
@@ -392,7 +384,7 @@ module Ci
def predefined_variables
[
{ key: 'CI_PIPELINE_ID', value: id.to_s, public: true },
- { key: 'CI_CONFIG_PATH', value: ci_yaml_file_path, public: true }
+ { key: 'CI_CONFIG_PATH', value: project.ci_config_file_for_pipeline, public: true }
]
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 1513402132b..381e9067ad1 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -526,6 +526,14 @@ class Project < ActiveRecord::Base
import_data&.destroy
end
+ def ci_config_file_for_pipeline
+ if ci_config_file.blank?
+ '.gitlab-ci.yml'
+ else
+ ci_config_file
+ end
+ end
+
def ci_config_file=(value)
# Strip all leading slashes so that //foo -> foo
super(value&.sub(%r{\A/+}, ''))
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 10b429c707e..0b06807e292 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1078,8 +1078,8 @@ class Repository
blob_data_at(sha, '.gitlab/route-map.yml')
end
- def gitlab_ci_yml_for(sha, path = '.gitlab-ci.yml')
- blob_data_at(sha, path)
+ def gitlab_ci_yml_for(sha)
+ blob_data_at(sha, project.ci_config_file_for_pipeline)
end
private