Hi
Our build process has a Pipe defined that uses `kubectl-run` to update a Deployment with a new image (built in the previous Pipelines step) and to then update labels on that Deployment with version information (the $BITBUCKET_COMMIT ENV).
The Deployment's image is updated correctly but the labels on the Deployment do not change.
There are no errors in the Pipelines log window or within the Pod's event log.
In the Pipelines log output I can see the part of the `docker run` command for `kubectl-run` with the relevant arguments are all correct:
...
--env=KUBECTL_COMMAND="set image deployment/APPNAME APPNAME=GROUP/IMAGE:$BITBUCKET_COMMIT" \--env=KUBE_CONFIG="$KUBECONFIG_QA" \
--env=LABELS_0="DD_TAGS=version:$BITBUCKET_COMMIT" \
--env=LABELS_1="VERSION=$BITBUCKET_COMMIT" \
--env=LABELS_COUNT="2" \
...
When I inspect the Deployment the `DD_TAGS` and `VERSION` labels have not been updated.
Is there some additional config that needs to be done within my Pipe to get this to work?
Regards
Andrew
@Andrew Male hi. According to k8s managing resources labels update works only with
KUBECTL_COMMAND='apply'
command.
So if you want update labels your should use something like this:
script:
# execute pipe with your custom command
- pipe: atlassian/kubectl-run:3.1.2
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: '<your custom command>'
...
script:
# update labels here - pipe: atlassian/kubectl-run:3.1.2 variables: KUBE_CONFIG: $KUBE_CONFIG KUBECTL_COMMAND: 'apply' RESOURCE_PATH: '<your path.yml>' LABELS: - 'label1=value1' - 'label2=value2'
We will update the pipe README to point that labels update should be used only with `apply` command.
Regards, Igor
@Andrew Male hi. Thanks for your question. We will investigate this and notify you about the results.
Regards, Igor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.