I’m using CircleCI 2 and this is my config.yml file:
version: 2
jobs:
build:
machine: true
working_directory: ~/komed-health-web
environment:
BS_PROJECT: "Komed Health on CircleCI"
BS_BUILD: "Build No. $CIRCLE_BUILD_NUM for CircleCI"
In my project the env variable BS_BUILD is now “Build No. CIRCLE_BUILD_NUM for CircleCI” (notice without the ). Am I doing something wrong? It also didn't work with "{CIRCLE_BUILD_NUM}" or {{ .Environment.CIRCLE_BUILD_NUM }}…
@levlaz Why was this functionality removed? I have this:
environment:
- API_URL: http://api.example.com
steps:
- run:
name: Deploy ${CIRCLE_PROJECT_REPONAME} to ${API_URL}
command: make all
That doesn’t work either, and I’m not sure the workaround above can be applied in any reasonable way to make it work. If I have to hardcode everything, I guess I will.
Any idea if future environment variable interpolation support will apply throughout the config.yml? I’d really like to be able to use them when mapping environment: and other settings when specifying additional docker images, for example:
In this example, it would be great if TEST_MESSAGE could come from the project environment settings since right now it just outputs $TEST_MESSAGE verbatim.
For the work around you provided do I have to add that run command to a certain section of the configuration yaml file? I’ve not seen a run section / command nor can I find it in the docs. I am trying to get the build number for a sed command that runs in our test -> post section of the build. Any help you can provide in getting a work around would be great.
Can you show a use case for this? Maybe there is a work-around. Without more detail it is hard to say if this would work, but look into a hardwired path for your artifact command, and then the creation of a symlink to that path in a prior step. This symlink creation can incorporate env vars.
You’d have to test this to see if Circle’s artifact system can read symlinks correctly, but it’s worth a try.
Hi !
I have a workflow, and all of the jobs will be running several testsuites.
I want to store artifacts for each testsuite run. I am hoping I can do something like this:
Right, I think my idea would work. Create a new run step before your store step, and in that, create a symlink from $WORKDIR/$BRANCH_$LABEL/abc_test/tests_html to /tmp/tests_html, and then you can use the hardwired path in your store step. Let me know how you get on.