diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-06 03:13:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-06 03:13:26 +0300 |
commit | b1159cdc7ac42b901842397dea4564e9a9464e5c (patch) | |
tree | 3deb779d83e685ce73c6ed17a7daea921be621e8 /app/models/concerns/ci | |
parent | 331eae9a3ed7cb11b22d23e5a03c38212dde01f0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/ci')
-rw-r--r-- | app/models/concerns/ci/contextable.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/concerns/ci/contextable.rb b/app/models/concerns/ci/contextable.rb index 6871482f71d..a9589cea5e9 100644 --- a/app/models/concerns/ci/contextable.rb +++ b/app/models/concerns/ci/contextable.rb @@ -17,6 +17,7 @@ module Ci variables.concat(project.predefined_variables) variables.concat(pipeline.predefined_variables) variables.concat(runner.predefined_variables) if runnable? && runner + variables.concat(kubernetes_variables) variables.concat(deployment_variables(environment: environment)) variables.concat(yaml_variables) variables.concat(user_variables) @@ -88,6 +89,18 @@ module Ci end 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 + end + def deployment_variables(environment:) return [] unless environment |