Kubernetes Cluster missing variables in CI due to action:prepare

Summary

Kubernetes Cluster, missing variables in CI

When using Kubernetes Cluster the deployment stage is missing some kubernetes configuration variables due to action:prepare

Background

As newer deployments cancel older deployment jobs, I will like to use action: prepare on a job to helm diff with cancelling a real deployment.

Proposal

Emit all the Kubernetes variables in https://docs.gitlab.com/ee/user/project/clusters/#deployment-variables for deployment jobs that use action:prepare.

Steps to reproduce

Add a Kubernetes cluster to GitLab and create a project with the following .gitlab-ci.yml:

stages:
  - deploy

deploy:
  stage: deploy
  image: xxxx/k8s-kubectl:latest
  script:
    - echo $KUBE_NAMESPACE
    - echo $KUBE_URL
    - echo $KUBECONFIG
    - cat $KUBECONFIG
    - echo $KUBE_TOKEN
  environment:
    name: stg/cam-2
    action: prepare
  only:
    - master

What is the current bug behavior?

Variables like KUBECONFIG, KUBE_NAMESPACE and KUBE_TOKEN are missing/empty

  • I can click Install Prometheus, and it installs correctly.
  • Kubernetes dashboard displays data such as node count correctly.
  • Clearing "Cache" does not seem to help.

What is the expected correct behavior?

All variables should be filled correctly and kubectl should be able to make a connection to the cluster

Relevant logs and/or screenshots

Example Project

This bug happens on GitLab.com

Edited Mar 22, 2021 by Hordur Freyr Yngvason
Assignee Loading
Time tracking Loading