# Update pipeline parameter in job or command?

**URL:** <https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815>\
**Category:** Build Environment\
**Created:** [July 23, 2020, 5:15pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815 "2020-07-23T17:15:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rprince](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@rprince](https://discuss.circleci.com/u/rprince)\
**Post date:** [July 23, 2020, 5:15pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/1 "2020-07-23T17:15:51Z")

</div>

I’d like to define a set of parameters at the top level, and modify or update them in the course of a workflow, and then use them in evaluating conditional workflows or logic (when statements) to decide whether to run jobs. Is that possible? I can do it by using environment variables, but that seems less elegant. Thanks in advance!

Thanks,  
Robert

---

<div class="post-metadata">

**Author:** ![JonathanC503](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jonathanc503/32/24364_2.png) [@JonathanC503](https://discuss.circleci.com/u/JonathanC503)\
**Post date:** [July 27, 2020, 1:46pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/2 "2020-07-27T13:46:11Z")

</div>

Hello @rprince - Thank you for being a member of our CircleCI community! In May of this year, we introduced advanced config-compile-time logic statements to config version 2.1. This might give you the conditional flexibility in using your `when` statements you are seeking.

This Discuss Post is the general announcement & description: [Advanced Logic in Config](https://discuss.circleci.com/t/advanced-logic-in-config/36011)

However, one of my colleagues in Support created the following Support Article which helps illustrate this and gives some example configs: [https://support.circleci.com/hc/en-us/articles/360043638052-Conditional-steps-in-jobs-and-conditional-workflows](https://support.circleci.com/hc/en-us/articles/360043638052-Conditional-steps-in-jobs-and-conditional-workflows)

Have a look at these articles and let us know if this helps!

---

<div class="post-metadata">

**Author:** ![rprince](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@rprince](https://discuss.circleci.com/u/rprince)\
**Post date:** [July 27, 2020, 4:26pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/3 "2020-07-27T16:26:24Z")

</div>

Hi @JonathanC503 ,

Thanks for your response. The flexible configuration is nice, but what I’m after is the ability to change the values of CircleCI config parameters dynamically. I understand that’s not possible currently, and I hope that you can add it in a future release.

Thanks!  
Robert

---

<div class="post-metadata">

**Author:** ![JonathanC503](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jonathanc503/32/24364_2.png) [@JonathanC503](https://discuss.circleci.com/u/JonathanC503)\
**Post date:** [July 27, 2020, 8:53pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/4 "2020-07-27T20:53:47Z")

</div>

Hello @rprince - Thank you for your update here. I did not realize you were seeking the ability to dynamically update config parameters within the build. You are correct in that is not possible at this time.

If you wouldn’t mind, could you describe your use-case and how this feature would benefit you or your team? Having this information helps us understand the business need more clearly. Thanks!

---

<div class="post-metadata">

**Author:** ![rprince](https://avatars.discourse-cdn.com/v4/letter/r/91b2a8/32.png) [@rprince](https://discuss.circleci.com/u/rprince)\
**Post date:** [July 27, 2020, 9:21pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/5 "2020-07-27T21:21:04Z")

</div>

Hi @JonathanC503,

Sorry for the initial confusion. As I mentioned I would like to modify or update parameters in the course of a workflow (dynamically, while it is running) and use them to determine when to run jobs.

For example, I have a workflow that includes generation of some artifacts that then get uploaded somewhere for later analysis. It’s not desirable to run that step every time; depending on the outcome of a previous job it may or may not be desirable. I would like the ability to evaluate during the workflow itself whether or not to run that part.

This would seem to call for some kind of state that is accessible throughout the workflow, and has the property that it (the state) can be updated/changed during the workflow. It’s that last part (runtime update of data initially provisioned at config-compile time) that I’m missing.

There’s certainly a number of ways to work around this, like pushing that state information to a remote file and reading/writing it as necessary. I’ve chosen to handle it in the scripts that ultimately get called by the workflow jobs or commands; the scripts themselves then choose whether or not to execute.

I hope that explains what I’m after - please let me know if it doesn’t.

Thanks,  
R

---

<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:** [July 28, 2020, 4:15am UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/6 "2020-07-28T04:15:47Z")

</div>

@rprince we needed similar functionality and what we ended up doing is storing the results we needed as an artifact and using the swissknife orb [get job artifact command](https://circleci.com/orbs/registry/orb/roopakv/swissknife#commands-get_job_artifacts) to fetch the set of results we need and based on the contents of this file we decided what to do.

I also added a command to get the job number of a [rerun job](https://circleci.com/orbs/registry/orb/roopakv/swissknife#commands-get_rerun_job_number). However if you have a specific kind of job whose number you need to be able to fetch let me know and I can add a command for you.

Yes this is definitely not as neat as dynamic workflows, buuut it gets close 🙂

---

<div class="post-metadata">

**Author:** ![amonica](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/amonica/32/28595_2.png) [@amonica](https://discuss.circleci.com/u/amonica)\
**Post date:** [November 9, 2021, 3:09pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/7 "2021-11-09T15:09:39Z")

</div>

@JonathanC503 - I have always wanted to be able to do this as well. I would consider this a basic feature due to the way I build workflows. My use case is this: I have a workflow like this:

- aws/create-changeset
- approve-changeset  
type: approval
- aws/execute-changeset
- run:  
command: some post-deploy commands I need to run

What ends up happening is the first step tries to create a change set, but there are no changes. However, I still need to go approve the empty changeset, then execute changeset runs. It wouldn’t be a big deal becuase the execute part doesn’t happen but I still have to wait for a container, install dependencies, etc… When really once I determine the changeset is empty I wish I could just skip both the appove AND the execute and go straight to the post-deploy script at the workflow level.

This is just one example, but I’ve run into many cases where I’ve wanted to do this.

Is there an API call I can make in the first step to set a pipeline parameter or something that I can then use as a conditional?

Thanks for the consideration

---

<div class="post-metadata">

**Author:** ![sursak123](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/sursak123/32/29660_2.png) [@sursak123](https://discuss.circleci.com/u/sursak123)\
**Post date:** [April 27, 2022, 11:57am UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/8 "2022-04-27T11:57:58Z")

</div>

Any update from circleci on this requirement of updating parameter value dynamically in the job?

---

<div class="post-metadata">

**Author:** ![tkidd77](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tkidd77/32/35152_2.png) [@tkidd77](https://discuss.circleci.com/u/tkidd77)\
**Post date:** [May 10, 2024, 4:19pm UTC](https://discuss.circleci.com/t/update-pipeline-parameter-in-job-or-command/36815/9 "2024-05-10T16:19:18Z")

</div>

This would be a great item to support and here’s why: Consider a Terraform “plan” job which updates a bool var “PLAN\_CHANGE” to inform the workflow if the terraform plan step is calling for 0 or 1+ changes. If false, exit and do not move on to approval step. If true move on to approval step. I doo not see an easier way to do this without this feature being added.
