Built in environment variables

I’m having trouble properly using the built in environment variables when using a win/default executor.

I would like to use the $CIRCLE_BUILD_NUM variable in my s3 bucket url, but nothing I’ve tried seems to work. I’ve tried CIRCLE_BUILD_NUM, {CIRCLE_BUILD_NUM}, %CIRCLE_BUILD_NUM%.

What have I got wrong?

Thanks!

Hi @cloudmike, welcome to Discuss!

To utilize variables in the Windows executor I believe the format as follows should work:

$env:CIRCLE_BUILD_NUM

If the above doesn’t work for you, can you let me know which shell you are utilizing for your builds?

Thanks!

Hi Nick,

I was able to get $env:CIRCLE_BUILD_NUM to work.

Was support for $env:CIRCLE_TAG dropped at some point? That’s the issue I’m having now.

Thanks,
Mike

Thanks for the reply and confirmation that worked for CIRCLE_BUILD_NUM .

As for the new issue you mentioned, CIRCLE_TAG is still supported. However, it will only ever be set on the build that was started from a tag. You’ll see it set in the “Preparing environment variables” step:

Screen Shot 2021-04-12 at 11.46.45 AM

If you aren’t finding it set for a build that started from a tag, can you share that build link with me so I can investigate further? If you aren’t comfortable sharing here, you can submit a support ticket instead.

Thanks!