Jenkins Version : 2.395
I am using Jenkins with github and created a Multibranch Pipeline job to build and test some source automatically.
In my Jenkinsfile script(located in my github repo), I use properties parameters to give some build options such as below.
string(defaultValue: ‘my_build_option’, description: ‘Build option name’, name: ‘BUILD_OPTION_NAME’, trim: true),
When a new branch is created inside my Multibranch Pipeline job by scanning the github repo, it works fine. But after that, when I change the properties parameters in my Jenkinsfile script, the next build executes with the previous properties parameters. This situation doesn’t change unless using ‘build with parameters’ in Dashboard > jobs > branches.
It only seems to work properly when a new branch is created inside the Multibranch Pipeline job for the first time.
Is there a way to apply the updated properties parameters value not using ‘build with paramters’?
Have this same issue, any changes to
properties on a
main branch Jenkinsfile does not get detected. Only solution I’ve found is having to nuke the entire multi branch pipeline and re-scan the GitHub org … This is pain …
Hello @taehun.kim and @ahmedammar.
Welcome to this community
As far as I know, in Jenkins Multibranch Pipelines, when you make changes to the Jenkinsfile or properties parameters in your GitHub repository, those changes may not immediately take effect in the existing branches. I think this is because Jenkins caches the Jenkinsfile and other configuration files for each branch to improve performance.
To force Jenkins to re-evaluate the Jenkinsfile and pick up the changes, you could trigger a re-scan of the Multibranch Pipeline job. This should refresh the cached configuration and apply any changes made to the Jenkinsfile and properties parameters. Here’s how you could trigger a re-scan:
- Go to the Jenkins dashboard.
- Navigate to your Multibranch Pipeline job.
- On the left-hand side, you’ll find a menu with options like “Status,” “Configure,” etc. Click on “Scan Repository Now.”
- Jenkins will initiate a re-scan of your GitHub repository, and the changes made to the Jenkinsfile and properties parameters should be picked up in the subsequent builds.
I’ve tried this, both repo scan and org scan does not work, I have to delete the multi branch pipeline and recreate it. Seems like a bug to me.