Support variable expansion in config.yml
X
Xcc
``
version: 2.1orbs: win: circleci/windows@2.4.0jobs: build: executor: win/default environment: THIRDPARTY_HOME: C:/Users/circleci/thirdparty CMAKE_HOME: ${THIRDPARTY_HOME}/cmake-3.16.4-win64-x64 CMAKE_BIN: ${CMAKE_HOME}/bin/cmake.exe steps: - run: shell: bash.exe command: ${CMAKE_BIN}
``results in ${CMAKE_HOME}/bin/cmake.exe unknown file or dirctory.I don't want to repeat C:/Users/circleci/thirdparty in different environment variables.Question asked in https://discuss.circleci.com/t/environment-variable-expansion-in-windows-bash-shell/34933.CCI-I-1427
V
Vinny Thanh
Because of how CircleCI works, we can't support environmental variable interpolation. When you commit or trigger a build on CircleCI, we process the configuration. This includes orbs, pipeline parameters, reusable config, etc. This results in a "compiled" version of the configuration, which finalizes before any environment is ever spun up.
There are two potential solutions:
1) You can use parameters. It looks like your THIRDPARTY_HOME is hard-coded to a specific directory, so you can just set either a pipeline or job parameter and then reuse that throughout the config. Here is documentation: https://circleci.com/docs/2.0/reusing-config/#using-the-parameters-declaration, https://circleci.com/docs/2.0/pipeline-variables/
2) We're currently working on a new feature called Setup Workflows. This feature would allow you to dynamically generate configuration to run in an initial "setup" workflow. See more details here: https://ideas.circleci.com/cloud-feature-requests/p/dynamic-config-aka-setup-jobs