<p>Currently what you are asking for is not possible. This is due to the way that the Jenkinsfile is loaded into the pipeline.</p>
<p>I think <a href="https://stackoverflow.com/users/772208/dolphy">dolphy</a> said it best on <a href="https://stackoverflow.com/a/46813693/1561176">this StackOverflow answer</a> (I saved this link a while ago to follow it for changes, because I had the same questions):</p>
<blockquote>
<p>Jenkins does not know about the new parameters until it retrieves, parses, and runs the Jenkinsfile, and the only way to do that is to...run a build.</p>
<p>In effect, the build history will always be &quot;one run behind&quot; the Jenkinsfile; when you change something in the Jenkinsfile, the next build will run with the &quot;old&quot; Jenkinsfile, but pick up and process the new Jenkinsfile for the build after that.</p>
</blockquote>
<p>There is also a <a href="https://issues.jenkins-ci.org/browse/JENKINS-41929" rel="nofollow noreferrer">related Jenkins Ticket</a> you can follow</p>

CC BY-SA 4.0
2018-06-05T12:58:53.520Z
2018-06-05T12:58:53.520Z
2020-06-18T08:28:10.803Z
Inbar Rose
<p>Is it possible to get changes of the parameterized pipeline on the fly after making changes there? </p>

<p>For example I have a pipeline code: </p>

<pre><code>properties([
        parameters([
                string(name: 'TARGET_HOST', defaultValue: 'test', description: 'Host on which artifact will be deployed'),
                string(name: 'ARTIFACT_ID', defaultValue: 'test', description: 'Name of artifact which will be doployed'),
                string(name: 'ARTIFACT_VERSION', defaultValue: '1', description: 'Version of artifact which will be deployed')
        ])
])
</code></pre>

<p>And I decided to change defaultValue for TARGET_HOST parameter from test to 1. </p>

<p>After such changes, I'll need to run job in order it apply changes and only running it for the second time after making changes, I'll obtain applied changes. </p>

<p>Is there a way to make job pick up changes during first run after making them? </p>

<p>So far I found a way to do it with Input structure: </p>

<pre><code>def values = input id: 'Run-test-suites',
        message: 'Workflow Configuration',
        ok: 'Run',
        parameters: [
                [
                        $class      : 'BooleanParameterDefinition',
                        defaultValue: true,
                        name        : 'checkboxVal',
                        description : 'Testing of checkbox param'
                ],
                [
                        $class      : 'StringParameterDefinition',
                        defaultValue: "test",
                        name        : 'stringVal',
                        description : 'Testing of string param'
                ],
                [
                        $class     : 'ChoiceParameterDefinition', choices: '1\n2\n3',
                        name       : 'choiceVal',
                        description: 'Testing of choice parameter'
                ]
        ]
</code></pre>

<p>But I want to have something more flexible. </p>

CC BY-SA 3.0
2018-03-15T18:20:03.333Z
Potentially related: https://groups.google.com/forum/#!msg/jenkinsci-users/YlbYq05sbdo/AA-r3EL1AgAJ
Dan Cornilescu
<jenkins><jenkins-pipeline><groovy>
Get changes of the parameterized pipeline on the fly in Jenkins
user54
# Get changes of the parameterized pipeline on the fly in Jenkins

(Asked by: username_0 on 2018-03-15)

Is it possible to get changes of the parameterized pipeline on the fly after making changes there? 
For example I have a pipeline code: 
properties([
        parameters([
                string(name: 'TARGET_HOST', defaultValue: 'test', description: 'Host on which artifact will be deployed'),
                string(name: 'ARTIFACT_ID', defaultValue: 'test', description: 'Name of artifact which will be doployed'),
                string(name: 'ARTIFACT_VERSION', defaultValue: '1', description: 'Version of artifact which will be deployed')
        ])
])

And I decided to change defaultValue for TARGET_HOST parameter from test to 1. 
After such changes, I'll need to run job in order it apply changes and only running it for the second time after making changes, I'll obtain applied changes. 
Is there a way to make job pick up changes during first run after making them? 
So far I found a way to do it with Input structure: 
def values = input id: 'Run-test-suites',
        message: 'Workflow Configuration',
        ok: 'Run',
        parameters: [
                [
                        $class      : 'BooleanParameterDefinition',
                        defaultValue: true,
                        name        : 'checkboxVal',
                        description : 'Testing of checkbox param'
                ],
                [
                        $class      : 'StringParameterDefinition',
                        defaultValue: "test",
                        name        : 'stringVal',
                        description : 'Testing of string param'
                ],
                [
                        $class     : 'ChoiceParameterDefinition', choices: '1\n2\n3',
                        name       : 'choiceVal',
                        description: 'Testing of choice parameter'
                ]
        ]

But I want to have something more flexible.

**Tags:** jenkins, jenkins-pipeline, groovy

> **Comments:**
> **username_1**: Potentially related: https://groups.google.com/forum/#!msg/jenkinsci-users/YlbYq05sbdo/AA-r3EL1AgAJ  

---

## 1 answers

### Answer by username_2 on 2018-06-05. Score: 3

Currently what you are asking for is not possible. This is due to the way that the Jenkinsfile is loaded into the pipeline.

I think [dolphy](https://stackoverflow.com/users/772208/dolphy) said it best on [this StackOverflow answer](https://stackoverflow.com/a/46813693/1561176) (I saved this link a while ago to follow it for changes, because I had the same questions):

> Jenkins does not know about the new parameters until it retrieves, parses, and runs the Jenkinsfile, and the only way to do that is to...run a build.
>
> In effect, the build history will always be "one run behind" the Jenkinsfile; when you change something in the Jenkinsfile, the next build will run with the "old" Jenkinsfile, but pick up and process the new Jenkinsfile for the build after that.

There is also a [related Jenkins Ticket](https://issues.jenkins-ci.org/browse/JENKINS-41929) you can follow


---

