Hi,
I want to add a secret to a default serviceaccount via tasks in azure devops but it does not work somehow (Kubernetes@1 task).
Thats my task:
displayName: "add secret to serviceaccount default"
inputs:
connectionType: "Kubernetes Service Connection"
kubernetesServiceEndpoint: "$(K8S_SE)"
namespace: myOwnNamespace
command: patch
arguments: >
serviceaccount default -p '{"imagePullSecrets": [{"name": "myImagePullSecret"}]}'```
I also tried multiple times to escape those quotes, but nothing works.
Thats the error message:
`error: unable to parse "'{imagePullSecrets:": yaml: found unexpected end of stream`
`##[error]error: unable to parse "'{imagePullSecrets:": yaml: found unexpected end of stream`
Instead of trying to deal with the hell that is escaping json I would put the json (or yaml works fine as well) in a file and pass the file to the patch command instead, much less error prone
-p is for patch inline. You use either -p or -f. If you use a file you do not use -p. You’re already specifying that it’s a patch by specifying the patch command.