Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,606
Community Members
 
Community Events
168
Community Groups

Bitbucket Pipe kubectl-run not updating LABELS

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

2 answers

1 accepted

0 votes
Answer accepted

@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

0 votes

@Andrew Male  hi. Thanks for your question. We will investigate this and notify you about the results.

 

Regards, Igor.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events