You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi guys, We have a problem with our pipeline.
We need to create a dynamic helmfile.yaml with a python script in pipeline, and use artifacts to pass to another step and run
If I run locally and manually all steps in the docker image, all works correctly, but in in bitbucket We always has a error with the yaml, our bitbucket-pipeline.yml:
name: "Prepare helmfile"
- cd ./.infra
- python myscript.py prd $BITBUCKET_BUILD_NUMBER
- cp ../charts/helmfile.yaml ../helmfile.yaml
- aws eks update-kubeconfig --region us-west-2
- 'echo -e "\n - image_tag: $BITBUCKET_TAG" >> helmfile.yaml'
- helmfile -e prod apply
we have errors like:
map has no entry for key "chart_repository"
in ./helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: line 25: mapping values are not allowed in this context
If we do a cat helmfile.yml in the Release step, we can see the entire file and is Ok.
locally we run image:
docker run -it --rm -v $(pwd)/:/myapp myrepo.amazonaws.com/base:latest sh
and inside the container
python myscript.py prd $BITBUCKET_BUILD_NUMBER
helmfile -e prod apply
and works perfectly.
What is wrong in the pipeline?
@carlos_mathiasen hi. Thanks for your question.
Maybe problem is with
'echo -e "\n - image_tag: $BITBUCKET_TAG" >> helmfile.yaml'
added to your helmfile with wrong indentation.
Maybe try to use envsubst (your should have helmfile template and helmfile.yaml will be generated dynamically with each build):
envsubst < helmfile.tpl.yaml > helmfile.yaml
Please read this article:
envsubst example , similar question