I am trying to deploy changes to my cluster using `kubectl apply -k ./` in a pipeline. My pipeline looks like this:
pipelines:
custom:
update-ref:
- step:
script:
- sed -E -i "s|([^-]- image:[^:]+).*|\1:$APP_COMMIT|g" deployments/app.yaml
- git add deployments/app.yaml
- git commit -m "[skip ci] Updating deployments/app.yaml with latest build number."
- git push
- pipe: atlassian/kubectl-run:1.1.6
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'apply'
KUBECTL_ARGS:
- '-k'
RESOURCE_PATH: './'
# WITH_DEFAULT_LABELS: 'false'
But I get the following error:
<span>Traceback (most recent call last):</span><span> File "/pipe.py", line 121, in <module></span><span> <a href="http://pipe.run/" target="_blank" rel="noopener nofollow noreferrer">pipe.run</a>()</span><span> File "/pipe.py", line 112, in run</span><span> self.handle_apply()</span><span> File "/pipe.py", line 77, in handle_apply</span><span> self.update_labels_in_metadata(template_file, labels)</span><span> File "/pipe.py", line 31, in update_labels_in_metadata</span><span> yaml_doc['metadata'].setdefault('labels', {}).update(labels)</span><span>KeyError: 'metadata'</span><span>Status: Downloaded newer image for bitbucketpipelines/kubectl-run:1.1.6</span>
I have also tried turning off default labels.