Hello everyone,
I'm trying to use a kubectl patch command to update a deployment by changing a metadata label on my deployment, the command i'm using is this one:
kubectl patch deployment my-deployment -n my-namespace -p '{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"redeploy\":\"55\"}}}}}'
When running it on power shell it works perfectly but when i add it to my pipeline i get all sorts of errors, currently my step is as follows:
- pipe: atlassian/azure-aks-deploy:1.0.2
variables:
AZURE_APP_ID: $AZURE_APP_ID
AZURE_PASSWORD: $AZURE_PASSWORD
AZURE_TENANT_ID: $AZURE_TENANT_ID
AZURE_AKS_NAME: $AKS_CLUSTER_NAME
AZURE_RESOURCE_GROUP: $AKS_RESOURCE_GROUP
KUBECTL_COMMAND: 'patch deployment my-deployment'
KUBECTL_ARGUMENTS: '-n my-namespace -p ''{\\"spec\\":{\\"template\\":{\\"metadata\\":{\\"labels\\":{\\"redeploy\\":\\"$BITBUCKET_BUILD_NUMBER\\"}}}}}'''
But the output of the pipeline is
<span>INFO: running kubectl command patch deployment my-deployment using generic handler</span>
<span>kubectl patch deployment my-deployment -n my-namespace -p '{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"redeploy\":\"55\"}}}}}'</span>
<span>Error from server (BadRequest): json: cannot unmarshal string into Go value of type map[string]interface {}</span>
<span>I've tried scaping that string in all sorts of ways but nothing works, even tried using the yaml style for the patch command with the same outcome. Is there something obvious i'm missing here?</span>