Answers: <p>This looks to me the same as the issue here : <a href="https://devops.stackexchange.com/questions/18687/how-to-modify-a-jenkins-pipeline-jobs-property-programmatically/19569#19569">How to modify a Jenkins pipeline job's property programmatically</a>.</p>
  <h4>Summary</h4>
  <ul>
  <li>You can either use <strong>Jenkinsfile</strong> ; this would require efforts but it's better in the long run, or you can use <strong>Jenkins API/CLI</strong> to <strong>get/update job configuration</strong>, with some kind of <strong>wrapper</strong> either <strong>Bash or Python</strong> to <strong>update your config.xml</strong> with your changes.</li>
  </ul>
  
Answers: CC BY-SA 4.0
Answers: 2024-08-16T20:23:15.343Z
Answers: 2024-08-18T20:07:00.123Z
Answers: 2024-08-18T20:07:00.123Z
Answers: YassineLbk
Answers: <p>You can invoke a pipeline with parameters in a step, in a stage, of your main pipeline. Here is an example from <a href="https://stackoverflow.com/questions/43337070/how-to-invoke-a-jenkins-pipeline-a-in-another-jenkins-pipeline-b">another answer</a>:</p>
  <pre><code>pipeline {
      agent
      {
          node {
                  label 'master'
                  customWorkspace &quot;${env.JobPath}&quot;
                }
      }
  
      stages 
      {
          stage('Start') {
              steps {
                  sh 'ls'
              }
          }
  
          stage ('Invoke_pipeline') {
              steps {
                  build job: 'pipeline1', parameters: [
                  string(name: 'param1', value: &quot;value1&quot;)
                  ]
              }
          }
  
          stage('End') {
              steps {
                  sh 'ls'
              }
          }
      }
  }
  </code></pre>
  <p>You can then use build parameters to pass data to a Jenkins job, and if needed parametrize it manually from a web interface. See these screenshots from this <a href="https://www.baeldung.com/ops/jenkins-parameterized-builds" rel="nofollow noreferrer">Baeldung guide</a>.</p>
  <p><a href="https://i.sstatic.net/Gsnd3h8Q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Gsnd3h8Q.png" alt="Build with Parameters" /></a></p>
  <p><a href="https://i.sstatic.net/KnLEUfyG.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KnLEUfyG.png" alt="Project parametrized-example" /></a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-08-18T20:56:36.223Z
Answers: 2024-08-18T20:56:36.223Z
Answers: Ortomala Lokni
Body: <p>I have multiple pipelines that I need to update each time the version of my program changes. Is it possible to create Jenkins pipelines (instead of clicking <code>+ New Item</code> in UI) or update them (for example which branch or tag to use, or time of execution) using another main pipeline. Otherwise every time something changes I have to go through each pipeline and click on <code>Configure</code> and update it manually.</p>
  
Comments: CC BY-SA 4.0
Comments: 2024-06-16T12:51:12.533Z
Comments: Givin' a very brief picture is using [Jenkins job builder](https://jenkins-job-builder.readthedocs.io/en/latest/) (a.k.a, JJB), and in your yaml file you can switch `repo_branch: master` to `repo_branch: <feature-branch>`. Afterwards you can apply the branch changes using `jenkins-jobs --conf <your conf.ini> update configs/your_job_.yaml:configs/defaults.yaml`, This could be useful in your case. However, adopting JJB into your pipeline requires more investigation.
Comments: Chachatonel Hashimotto
Comments: CC BY-SA 4.0
Comments: 2024-08-08T11:52:42.117Z
Comments: Can that change be parameterized?
Comments: Iterokun 
Tags: <jenkins><jenkins-pipeline><automation>
Title: Automating Jenkins Pipeline Creation and Configuration Updates
UserDisplayName: Mykola Zotko
ThreadText: # Automating Jenkins Pipeline Creation and Configuration Updates
  
  (Asked by: username_0 on 2024-05-24)
  
  I have multiple pipelines that I need to update each time the version of my program changes. Is it possible to create Jenkins pipelines (instead of clicking `+ New Item` in UI) or update them (for example which branch or tag to use, or time of execution) using another main pipeline. Otherwise every time something changes I have to go through each pipeline and click on `Configure` and update it manually.
  
  **Tags:** jenkins, jenkins-pipeline, automation
  
  > **Comments:**
  > **username_1**: Givin' a very brief picture is using [Jenkins job builder](https://jenkins-job-builder.readthedocs.io/en/latest/) (a.k.a, JJB), and in your yaml file you can switch `repo_branch: master` to `repo_branch: <feature-branch>`. Afterwards you can apply the branch changes using `jenkins-jobs --conf <your conf.ini> update configs/your_job_.yaml:configs/defaults.yaml`, This could be useful in your case. However, adopting JJB into your pipeline requires more investigation.  
  > **username_2**: Can that change be parameterized?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2024-08-16. Score: 1
  
  This looks to me the same as the issue here : [How to modify a Jenkins pipeline job's property programmatically](https://devops.stackexchange.com/questions/18687/how-to-modify-a-jenkins-pipeline-jobs-property-programmatically/19569#19569).
  
  #### Summary
  
  * You can either use **Jenkinsfile** ; this would require efforts but it's better in the long run, or you can use **Jenkins API/CLI** to **get/update job configuration**, with some kind of **wrapper** either **Bash or Python** to **update your config.xml** with your changes.
  
  
  ---
  
  ### Answer by username_4 on 2024-08-18. Score: 0
  
  You can invoke a pipeline with parameters in a step, in a stage, of your main pipeline. Here is an example from [another answer](https://stackoverflow.com/questions/43337070/how-to-invoke-a-jenkins-pipeline-a-in-another-jenkins-pipeline-b):
  
  ```
  pipeline {
      agent
      {
          node {
                  label 'master'
                  customWorkspace "${env.JobPath}"
                }
      }
  
      stages 
      {
          stage('Start') {
              steps {
                  sh 'ls'
              }
          }
  
          stage ('Invoke_pipeline') {
              steps {
                  build job: 'pipeline1', parameters: [
                  string(name: 'param1', value: "value1")
                  ]
              }
          }
  
          stage('End') {
              steps {
                  sh 'ls'
              }
          }
      }
  }
  
  ```
  
  You can then use build parameters to pass data to a Jenkins job, and if needed parametrize it manually from a web interface. See these screenshots from this [Baeldung guide](https://www.baeldung.com/ops/jenkins-parameterized-builds).
  
  [![Build with Parameters](https://i.sstatic.net/Gsnd3h8Q.png)](https://i.sstatic.net/Gsnd3h8Q.png)
  
  [![Project parametrized-example](https://i.sstatic.net/KnLEUfyG.png)](https://i.sstatic.net/KnLEUfyG.png)
  
  
  ---
  
  