diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-09-06 19:57:07 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-09-06 19:57:07 +0300 |
commit | 82ed2a0909823807f3ece2cb29bfc501293361a0 (patch) | |
tree | 697cee39fdf2ef7ec353d32016f96052cb6c6459 /app/models/ci | |
parent | 8189347b4986e2e44b30d04bf9e83c11e76feef8 (diff) |
Improve config source handling code
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/build.rb | 1 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 28c16d4037f..c439997d636 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -217,6 +217,7 @@ module Ci variables += runner.predefined_variables if runner variables += project.container_registry_variables variables += project.deployment_variables if has_environment? + variables += project.auto_devops_variables variables += yaml_variables variables += user_variables variables += project.group.secret_variables_for(ref, project).map(&:to_runner_variable) if project.group 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 |