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
Next: Root
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
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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
helmfile apply
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:
tags:
'v*':
- step:
name: "Prepare helmfile"
image: python:3.7.2
size: 2x
script:
- cd ./.infra
- python myscript.py prd $BITBUCKET_BUILD_NUMBER
- cp ../charts/helmfile.yaml ../helmfile.yaml
services:
- docker
caches:
- docker
artifacts:
- helmfile.yaml
- step:
name: "Release"
trigger: manual
script:
- 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"
or
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:
https://github.com/roboll/helmfile/issues/429#issuecomment-455864318
Additional links:
envsubst example , similar question
Regards, Igor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.