diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-04 03:08:30 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-04 03:08:30 +0800 |
commit | 63bf2457e40ffd465d9a5aeee9b26b1c82432f9d (patch) | |
tree | c9733e297dbf0500ffb1de8b511eb52fa9c66c45 /app | |
parent | d7c32c5870ff7122122d0fc75ed8a04a0818251e (diff) | |
download | gitlab-ce-63bf2457e40ffd465d9a5aeee9b26b1c82432f9d.tar.gz |
Follow feedback on the merge request
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 16 | ||||
-rw-r--r-- | app/models/project.rb | 8 | ||||
-rw-r--r-- | app/models/repository.rb | 4 |
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 |