How to use {{ }} placeholders and environment variables in file names


#1

I want to create a tar from my build project and store it as an artifact. But I have problems using {{}} because variables are not replaced.

How should I do this correctly?

  - run: tar -zcvf {{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}.tar.gz ./build
  - store_artifacts:
      path: ./{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}.tar.gz
      prefix: '{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}.tar.gz'

Also if I want to include a custom env var in the name how can I do this?
{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}{{ .Environment.MY_ENV_VAR}}.tar.gz


#2

never mind, I solved it using eval


#3

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.