Nested Environment variable for docker container

I want to be able to use the key/value pairs under environment: which will be used in a step within the build process, however it appears not to like the nested env var for IMAGE:, it doesn’t appear to be extracting the values within the nested env vars:

ERROR: (gcloud.container.images.describe [${DOCKER_IMAGE}:${CIRCLE_BRANCH}-${CIRCLE_SHA1}]

I need to be able to construct the IMAGE: env var to use in a step low down in this build stage - to pass into an orb called binary auth. For more context:

environment:
      DOCKER_IMAGE: "eu.gcr.io/gcr/someimagename"
      IMAGE: ${DOCKER_IMAGE}:${CIRCLE_BRANCH}-${CIRCLE_SHA1}
    steps:
      - binary-auth/binary-auth

What’s the best way of doing this?

Currently followed this: Using Environment Variables - CircleCI

This seems to be coming up a lot at the moment.

The bad news is that you can not. The current implementation of the config.yml parsers does not seem to process environment variables. So they work only when shell-based commands are executed.

1 Like