Continuation parameters w/ evaluated environmental variables

I have a Setup step then generates some ENVs. I was expecting to pass this to the following config via the Configuration Orb. However, I am having trouble determining how to pass the ‘evaluated’ version of the ENVs within the parameter string. I have tried $ and {{ $ }} syntax as well as leaving off the “” around the ENV. Trying << throws a configuration error indicating they need to be escaped. That clearly means that isn’t evaluating the value…

When the string is evaluated and the pipeline.parameters.buildNumber is echoed in a subsequent Job, it just shows up as $CIRCLE_BUILD_NUM

Hi,

I believe I have responded to a team member of yours with the solution, but posting here too for visibility.

Currently, the parameters string’s values are not being evaluated. This is something I am looking into fixing. For now, we can echo those parameters into a json file in a pre-step before the orb command is called. The pre-step is neccesary because each job will spin up it’s own environment.

Here’s an example workflow:

workflows:
  setup:
    jobs:
      - continuation/continue:
          configuration_path: ".circleci/test.yml"
          parameters: /home/circleci/test.json
          pre-steps:
            - run:
                command: |
                  export TEST_ENV="hello world"
                  echo '{ "test-string": "'$TEST_ENV'" }' >> /home/circleci/test.json

Notice the triple quote (a ’ and ") before the EV is called. This is so that the echo command will evaluate the environment variable. Also, the destination must be something other than the default working directory (~/project) as the continuation/continue step calls the checkout command which will fail if the directory already exists.

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