Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

0 votes

@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
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,452 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you