diff options
Diffstat (limited to 'app/models/concerns/ci/contextable.rb')
-rw-r--r-- | app/models/concerns/ci/contextable.rb | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/app/models/concerns/ci/contextable.rb b/app/models/concerns/ci/contextable.rb index 12ddbc2cc40..ed3b422251f 100644 --- a/app/models/concerns/ci/contextable.rb +++ b/app/models/concerns/ci/contextable.rb @@ -13,6 +13,8 @@ module Ci track_duration do variables = pipeline.variables_builder.scoped_variables(self, environment: environment, dependencies: dependencies) + next variables if pipeline.use_variables_builder_definitions? + variables.concat(project.predefined_variables) variables.concat(pipeline.predefined_variables) variables.concat(runner.predefined_variables) if runnable? && runner @@ -60,49 +62,27 @@ module Ci end def user_variables - Gitlab::Ci::Variables::Collection.new.tap do |variables| - break variables if user.blank? - - variables.append(key: 'GITLAB_USER_ID', value: user.id.to_s) - variables.append(key: 'GITLAB_USER_EMAIL', value: user.email) - variables.append(key: 'GITLAB_USER_LOGIN', value: user.username) - variables.append(key: 'GITLAB_USER_NAME', value: user.name) - end + pipeline.variables_builder.user_variables(user) end def kubernetes_variables - ::Gitlab::Ci::Variables::Collection.new.tap do |collection| - # Should get merged with the cluster kubeconfig in deployment_variables, see - # https://gitlab.com/gitlab-org/gitlab/-/issues/335089 - template = ::Ci::GenerateKubeconfigService.new(self).execute - - if template.valid? - collection.append(key: 'KUBECONFIG', value: template.to_yaml, public: false, file: true) - end - end + pipeline.variables_builder.kubernetes_variables(self) end def deployment_variables(environment:) - return [] unless environment - - project.deployment_variables( - environment: environment, - kubernetes_namespace: expanded_kubernetes_namespace - ) + pipeline.variables_builder.deployment_variables(job: self, environment: environment) end def secret_instance_variables - project.ci_instance_variables_for(ref: git_ref) + pipeline.variables_builder.secret_instance_variables(ref: git_ref) end def secret_group_variables(environment: expanded_environment_name) - return [] unless project.group - - project.group.ci_variables_for(git_ref, project, environment: environment) + pipeline.variables_builder.secret_group_variables(environment: environment, ref: git_ref) end def secret_project_variables(environment: expanded_environment_name) - project.ci_variables_for(ref: git_ref, environment: environment) + pipeline.variables_builder.secret_project_variables(environment: environment, ref: git_ref) end end end |