Fairly new to GitLab-CI, I'm trying to deploy via Helm on a Kubernetes cluster. I have this:
image: docker:stable
deploy:
stage: deploy
image:
name: alpine/helm:3.4.1
script:
- echo "Deploying to production"
- helm list --all-namespaces
And it fails with:
Error: unknown command "sh" for "helm"
And the echo is not echoed, however, If I were to remove the echo line, the helm cmd would execute successfully.
I guess I'm asking how to make multiline scripts run? How do the gitlab-runner executes the series of commands provided in the script: array?
Each entry in the script array runs in an sh shell.
sh -x 'echo "Deploying to production"'
The alpine/helm image you are using contains an entrypoint of helm
Which means the sh command gitlab is trying to run is being appended to the entrypoint as an argument (e.g. helm sh -x 'echo "Deploying to production"')
Override the entrypoint
deploy:
stage: deploy
image:
name: alpine/helm:3.4.1
entrypoint: [""]
script:
- echo "Deploying to production"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With