$PUBLISH_ON_PROD triggers the auto deployment to production
The $PUBLISH_ON_PROD environment variable triggers the auto deployment to production, as seen in the k8s-production job rules:
rules:
# exclude non-production branches
- if: '$CI_COMMIT_REF_NAME !~ $PROD_REF'
when: never
# exclude if $K8S_PROD_SPACE not set
- if: '$K8S_PROD_SPACE == null || $K8S_PROD_SPACE == ""'
when: never
# if $AUTODEPLOY_TO_PROD: auto
- if: '$AUTODEPLOY_TO_PROD == "true"'
# else if PUBLISH_ON_PROD enabled: auto (because the publish job was blocking)
- if: '$PUBLISH_ON_PROD == "true"'
# else: manual, blocking
- if: $K8S_PROD_SPACE # useless test, just to prevent GitLab warning
when: manual
This variable is not documented in the doc and comes from other templates such as Cloud Native Buildpacks. I think we should remove this rule to avoid side-effects. This is especially insidious as $PUBLISH_ON_PROD has a default value of true in the CNB template, meaning when combining the two templates one has to explicitly set PUBLISH_ON_PROD=False on the kubernetes job to disable this behavior.