How/when does Jenkins refresh job configuration (params, etc.) from pipeline script?

1,600 views
Skip to first unread message

Pavel Strashkin

unread,
Apr 17, 2017, 12:55:24 PM4/17/17
to Jenkins Users
Hi there,

I wonder if anyone has details about how/when jenkins refreshes job configuration from pipeline script (Jenkinsfile)? Is it when build is triggered or some background job? What if I just want to adjust configuration (add optional params) w/o running stages, how would I achieve so?

Thanks!

thomas....@teamaol.com

unread,
Apr 20, 2017, 7:36:26 AM4/20/17
to Jenkins Users
Basically the pipeline script is code and as long the code is not executed it does nothing.
If you decide to adjust job configuration via script like "poll scm", "interval", enable/disable concurrent build
and how many history entries to keep then it will affect next build only.

You have following options  ...

 a) Pipeline job: you specify all fix parameters and then load the Jenkinsfile from your repository. The process is coded the parameters are manual.
 b) Multibranch pipeline job: you don't have any parameters and each remote branch can build in parallel. The pipeline code need to decide
     when to do what ... (example: you could eval the git branch and decided by where to deploy or where to deploy anyway). So basicall all is coded.

If you have same job running in multiple Jenkins instances (like cloud: AWS regions) then you might wanna also investigate
into Job DSL which is an extension the whole process. It allows to write a seed job that could run on each of your Jenkins instances creating
the required Jenkins jobs for you automatically.

A final word of warning related coded parameters ...
The pipeline DSL is - unfortunately - not designed to implement a behavior for such job parameters
which reflect the often seen Language feature "+=" (append) which means when you change one option only all other parameters you might have set manually
in the job configuration are overwritten. As an example ... if you do following ... look at the pipeline syntax for the properties and adjust those two entries same way and
then you see which options are additional changed ...

properties([
    // Max # of builds to keep: 10
    buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
    // Do not allow concurrent builds
    disableConcurrentBuilds()
])


Kind Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages