Environment variables in circle.yml


#1

Hi, I’ve been trying to use environment variables to generalise in our circle.yml but they keep on being printed literally. The below circle.yml illustrates attempting to use a circle ci environment variable directly and another setting up an environment variable for the script in case that caused it to work differently

machine:
  environment:
    PROJECT_NAME: ${CIRCLE_PROJECT_REPONAME}

  services:
    - docker

dependencies:
  override:
    - docker info
    - docker build -t ${PROJECT_NAME}_${CIRCLE_BUILD_NUM} .

test:
    override:
        - docker run --net=host --name ${PROJECT_NAME}_test ${PROJECT_NAME}_${CIRCLE_BUILD_NUM} py.test

deployment:
  dump:
    branch: master
    commands:
      - docker save -o ${CIRCLE_ARTIFACTS}/${PROJECT_NAME}_${CIRCLE_BUILD_NUM}.tar ${PROJECT_NAME}_${CIRCLE_BUILD_NUM}

example output from circle:

$ docker run --net=host --name ${PROJECT_NAME}_test ${PROJECT_NAME}_${BUILD_NUM} py.test

As you can see the variables have not been substituted. All help appreciated.


#2

Turns out it just doesn’t show up in the circleci reporting but exported artifacts are named correctly


#3