# Passing an environment variable to 'parameters' in the continuation/continue command does not work

**URL:** <https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832>\
**Category:** Build Environment\
**Tags:** pipelines, circle-yml, dynamic-config\
**Created:** [August 3, 2021, 10:50am UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832 "2021-08-03T10:50:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dragosMC91](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/dragosmc91/32/27561_2.png) [@dragosMC91](https://discuss.circleci.com/u/dragosMC91)\
**Post date:** [August 3, 2021, 10:50am UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/1 "2021-08-03T10:50:08Z")

</div>

Hello,

I have recently started using dynamic configs since there are multiple issues which this feature will fix in our ci.

The latest problem I am experiencing is that I am trying to pass a dynamic json object to the continuation/continue for example:

```auto
version: 2.1
setup: true
orbs:
  continuation: circleci/continuation@0.2.0
jobs:
  Execute_Workflow:
    executor: continuation/default
    steps:
      - checkout
      - run:
          name: Trying to set a dynamic pipeline var
          command: |
            hash="a87joe90rqhidaids23" # just an example, hash will be generated based on more complex logic
            echo "extra_parameters='{ \"backend_hash\"":" \"$hash\" }'" >> $BASH_ENV
            source $BASH_ENV
            echo $extra_parameters
      - continuation/continue:
          configuration_path: .circleci/config.packed.yml
          parameters: |
            $extra_parameters
workflows:
  Execute_Workflow:
    jobs:
      - Execute_Workflow

```

The problem is I am getting the error `PARAMETERS aren't valid json` in the setup phase in the continuation command.  
If I were to use

```auto
          parameters: |
            { "backend_hash": "a87joe90rqhidaids23" }

```

everything works as expected but as stated before `a87joe90rqhidaids23` is generated dynamically.

Note that the following does not work either:

```auto
          parameters: |
            { "backend_hash": "$PREVIOUSLY_EXPORTED_ENV_VAR" }

```

How could I bypass this?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![dragosMC91](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/dragosmc91/32/27561_2.png) [@dragosMC91](https://discuss.circleci.com/u/dragosMC91)\
**Post date:** [August 3, 2021, 6:58pm UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/2 "2021-08-03T18:58:24Z")

</div>

I am using the workaround presented here: [Continuation parameters w/ evaluated environmental variables](https://discuss.circleci.com/t/continuation-parameters-w-evaluated-environmental-variables/40256)

so many workarounds…

---

<div class="post-metadata">

**Author:** ![roopakv](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/roopakv/32/17711_2.png) [@roopakv](https://discuss.circleci.com/u/roopakv)\
**Post date:** [August 5, 2021, 11:31pm UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/3 "2021-08-05T23:31:09Z")

</div>

Also check out the swissknife orb. I have built it in a nice continue which lets you pass params in to the continue config.

[https://circleci.com/developer/orbs/orb/roopakv/swissknife#jobs-filter-and-continue](https://circleci.com/developer/orbs/orb/roopakv/swissknife#jobs-filter-and-continue)

---

<div class="post-metadata">

**Author:** ![yannCI](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/yannci/32/24866_2.png) [@yannCI](https://discuss.circleci.com/u/yannCI)\
**Post date:** [August 6, 2021, 12:21pm UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/4 "2021-08-06T12:21:03Z")

</div>

👋 Hi @dragosMC91,

I think the issue in your initial configuration stems from the double-quotes around the `:` character.

Both the below syntaxes will work:

- `echo "extra_parameters='{ \"backend_hash\" : \"$hash\" }'" >> $BASH_ENV`

- `echo "extra_parameters='{ "backend_hash" : "'"$hash"'" }'" >> $BASH_ENV` (around `$hash`: double-quote/single-quote/double-quote)

---

<div class="post-metadata">

**Author:** ![dragosMC91](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/dragosmc91/32/27561_2.png) [@dragosMC91](https://discuss.circleci.com/u/dragosMC91)\
**Post date:** [August 11, 2021, 7:51am UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/5 "2021-08-11T07:51:51Z")

</div>

Hello, thank you for your help, I got it to work eventually 😃

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [October 8, 2021, 11:57pm UTC](https://discuss.circleci.com/t/passing-an-environment-variable-to-parameters-in-the-continuation-continue-command-does-not-work/40832/6 "2021-10-08T23:57:19Z")

</div>

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