diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb010834c336cb8e19ce7a1d978c24646d748985..c4d313b480574f5ff4c03329088034cad1c6dc63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,17 @@ +#--------- GitLab Agent CI/CD Tunnel configuration +# Set KUBE_CONTEXT to use with the GitLab Kubernetes Agent's CI/CD tunnel. See +# https://docs.gitlab.com/ee/user/clusters/agent/ci_cd_tunnel.html. +#----------------------------------- +# variables: +# Set the variable $KUBE_CONTEXT through the GitLab UI, or set it here by +# uncommenting the following two lines and replacing the Agent's path with your own: +# variables: +# KUBE_CONTEXT: path/to/your-agent-configuration-project:your-agent-name + +.kube-context: + before_script: + - if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi + # -------- Helm v2 release detection # The detect-helm2-release will try to identify if you have any app installed with Helm v2. # If so, it will fail the pipeline and ask you to migrate those apps to Helm v3, since @@ -10,7 +24,9 @@ # installed in the gitlab-managed-apps namespace. If you were using a different namespace, feel # free to replace gitlab-managed-apps by whatever that is in the script below. #----------------------------------- + detect-helm2-releases: + extends: [.kube-context] stage: test image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v1.1.0" environment: @@ -21,6 +37,7 @@ detect-helm2-releases: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH apply: + extends: [.kube-context] stage: deploy image: "registry.gitlab.com/gitlab-org/cluster-integration/cluster-applications:v1.1.0" environment: