Project only visible to the CI run on master and not any other branch.
I am creating review environments and production environment using the Gitalab CI/CD.
For this I am using the image repository.
When running the pipeline on master everything works my variables defined in the settings with the scope set to all.
The master environment is production. However, when trying to create a new branch and therefore a review environment the runner cannot see my Variables that I have defined in the settings (Remember the scope is set to all environments)
Here is my production deploy code:
deploy:
stage: deploy
variables:
DEPLOY_SUFFIX: prod
DEPLOY_HOST: todo.chrupek.tech
environment:
name: production
url: http://todo.chrupek.tech
image: roffe/kubectl:v1.13.2
script:
- kubectl delete --ignore-not-found=true secret gitlab-auth
- kubectl create secret docker-registry gitlab-auth --docker-server=$CI_REGISTRY --docker-username=$KUBE_PULL_USER --docker-password=$KUBE_PULL_PASS
- cat deployment.yaml | envsubst | kubectl apply -f -
only:
- master
And here is the code for the review
review:
stage: deploy
variables:
DEPLOY_SUFFIX: $CI_COMMIT_REF_SLUG
DEPLOY_HOST: ...
environment:
name: review/$CI_COMMIT_REF_SLUG
url: ...
# on_stop: stop_review
image: roffe/kubectl:v1.13.2
script:
- echo $KUBE_PULL_USER
# - kubectl delete --ignore-not-found=true secret gitlab-auth
# - kubectl create secret docker-registry gitlab-auth --docker-server=$CI_REGISTRY --docker-username=$KUBE_PULL_USER --docker-password=$KUBE_PULL_PASS
# - cat deployment.yaml | envsubst | kubectl apply -f -
only:
- branches
except:
- master
As you can see i am trying to print the $KUBE_PULL_USER which works in production deploy stage, however it does not work in the review stage.
If anyone would have an idea what is wrong I will be greatefull.
PS. The … are personal names and they are filled in.