diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-09-06 18:57:07 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-09-06 18:57:07 +0200 |
commit | 82ed2a0909823807f3ece2cb29bfc501293361a0 (patch) | |
tree | 697cee39fdf2ef7ec353d32016f96052cb6c6459 /app/models/ci/pipeline.rb | |
parent | 8189347b4986e2e44b30d04bf9e83c11e76feef8 (diff) | |
download | gitlab-ce-82ed2a0909823807f3ece2cb29bfc501293361a0.tar.gz |
Improve config source handling code
Diffstat (limited to 'app/models/ci/pipeline.rb')
-rw-r--r-- | app/models/ci/pipeline.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index e72843d085e..0e1b3b29e07 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -325,15 +325,11 @@ module Ci end def set_config_source - self.config_source = - if project - case - when ci_yaml_from_repo then :repository_source - when implied_ci_yaml_file then :auto_devops_source - end - else - :unknown_source - end + if ci_yaml_from_repo + self.config_source = :repository_source + elsif implied_ci_yaml_file + self.config_source = :auto_devops_source + end end def config_processor @@ -461,12 +457,17 @@ module Ci private def ci_yaml_from_repo + return unless project + return unless sha + project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path) rescue GRPC::NotFound, Rugged::ReferenceError, GRPC::Internal nil end def implied_ci_yaml_file + return unless project + if project.auto_devops_enabled? Gitlab::Template::GitlabCiYmlTemplate.find('Auto-DevOps').content end |