Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,455,380
Community Members
 
Community Events
175
Community Groups

Helmfile has a lot of errors in bitbucket-pipeline

Edited

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?

1 answer

@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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events