Env_var_name in Orb with local build

I’m trying to convert some existing variables to use a env_var_name parameter. The problem I’m running into is I can’t figure out how to run a local build and get the env_var_name parameter to have a “real” value (other than that define by the “default” field) during the local build.

For example, given an Orb that defines a parameter like this:

  parameters:
    myEnvVar:
      type: env_var_name
      default: MY_ENV_VAR

My workflow (for better of worse) is:

  1. Process my inline Orb into a “local” compatible config. Like:

    circleci config process .circleci/config.yml > .circleci/local-config.yml
    
  2. Run the local-config via a shell script that provide values for the command line via the -e parameter. Like this:

    circleci local execute -c .circleci/local-config.yml --job 'build' -e MY_ENV_VAR=someRealValue
    

When the local build executes, the value found in the parameter myEnvVar (via: << parameters. myEnvVar >> ) is always just the “default” variable name (MY_ENV_VAR). My goal is to make the local build see the value “someRealValue”. Is this possible? Thanks!

Hello @bhamail,

In order to use 2.1 config locally at the moment, you must first pre-process the config file into a standard 2.0 file.

circleci config process <path> this will produce a file that should work with your local cli run.

Please let us know if you run into any issues. Thank you!

Hi Kyle,

Thanks for the reply, but I believe my example shows I’m already processing the file into a 2.0 format. (see above).

circleci config process .circleci/config.yml > .circleci/local-config.yml
circleci local execute -c .circleci/local-config.yml --job 'build' -e MY_ENV_VAR=someRealValue

Running the resulting 2.0 config (.circleci/local-config.yml) is not populate the env_var_name parameter with the desired value (“someRealValue”). Am I missing something?