ENV concat

Hi,
I’m trying to concatenate ENV variables, but I’m lost.
Do you have any advice ?

  • gcp-gke/rollout-image:
    deployment: cluster-1
    container: webapp
    image: ‘{AWS_ECR_ACCOUNT_URL}/{AWS_RESOURCE_NAME_PREFIX}:${CIRCLE_SHA1}’

Welcome to Discuss @arag00rn!

You should be able to insert multiple environment variables into a string by doing something like the following:

"${AWS_ECR_ACCOUNT_URL}/${AWS_RESOURCE_NAME_PREFIX}:${CIRCLE_SHA1}"

Essentially each variable needs to be surrounded by ${} – give the above a try and let me know if you continue to have any issues! Thanks!

Hi,

thank you for the suggestion. Unfortunately it doesn’t work. It was my first try.
If I use: "{AWS_ECR_ACCOUNT_URL}/{AWS_RESOURCE_NAME_PREFIX}:{CIRCLE_SHA1}" I get {AWS_ECR_ACCOUNT_URL}/{AWS_RESOURCE_NAME_PREFIX}:{CIRCLE_SHA1}

String won’t be translated into variables’s values.

I founded a workaround using envsubst like suggested here but actually I don’t like.

Thanks,
Andrea

Hi @arag00rn! Thanks for the reply and additional details!

Can you go ahead and submit a support ticket with a link to the build that didn’t correctly work with this format:

"${AWS_ECR_ACCOUNT_URL}/${AWS_RESOURCE_NAME_PREFIX}:${CIRCLE_SHA1}"

That way we can take a look at your specific setup and provide some additional information. Feel free to also include a link to this post so we can reference it as well. Thank you!