As part of the pipeline I want to check the kubernetes deployment scripts for syntax errors. I am adding the --dry-run=client (or just --dry-run) to the deploy command. But that seems to be ignored and the script gets executed as it were called without --dry-run.
The pipeline is defined as below:
- pipe: atlassian/aws-eks-kubectl-run:1.4.1
variables:
AWS_ACCESS_KEY_ID: "$AWS_DEV_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY: "$AWS_DEV_SECRET_ACCESS_KEY"
AWS_DEFAULT_REGION: "$AWS_DEV_DEFAULT_REGION"
CLUSTER_NAME: "$AWS_CLUSTER_NAME"
KUBECTL_COMMAND: "apply"
RESOURCE_PATH: "k8s/deploy/aws-dev"
KUBECTL_ARGS: "--dry-run=client"
KUBECTL_APPLY_ARGS: "-k"
How can I achieve that behavior?
Hi @Brad Vrabete ,
Thank you for your question!
The pipe atlassian/aws-eks-kubectl-run:1.4.1 based on kubectl v1.17.
According to the kubectl v1.17 documentation apply command supports the next flags only:
If true, only print the object that would be sent, without sending it.
Warning:
--dry-run cannot accurately output the result of merging the local manifest and the server-side data.Use --server-dry-run to get the merged result instead.
so, recommended way is "--server-dry-run".
Also, we are investigating bump version of the kubectl.
Cheers,
Oleksandr Kyrdan
Thanks for the answer. The strange thig is that it works if I put all the parameters in the KUBECTL_COMMAND parameter and remove the rest; that's why I thought there must be something in the pipe that prevents it from running. I di not try --server-dry-run.
Are you filtering the parameters passed to the pipe? That would not be a good idea as it is hard to know what went wrong (hence my question); I would rather get the error message from kubectl and let people handle that.
In any case I'll try with --server-dry-run.
Thanks,
Brad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep, good question! It shouldn't filter or modify passed params.
We are investigating this case and notify you.
Thank you!
Oleksandr Kyrdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.