[JCasC] job parameters lost when re-starting docker container / reloading existing configuration

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[JCasC] job parameters lost when re-starting docker container / reloading existing configuration

Danny Trunk
Hello everyone,

I've set up a container with jenkins.yaml file in $JENKINS_HOME which is loading a parameterized pipeline job:

  - script: >
      pipelineJob('lineage') {
        definition {
          cpsScm {
            scriptPath 'Jenkinsfile'
            scm {
              git {
                configure { git ->
                  git / 'extensions' / 'hudson.plugins.git.extensions.impl.SparseCheckoutPaths' / 'sparseCheckoutPaths' {
                    'hudson.plugins.git.extensions.impl.SparseCheckoutPath' {
                extensions {}
                remote {

In order to retrieve the parameters defined in the Jenkinsfile it needs to be initially run.
There's a known issue which described that behaviour: https://issues.jenkins-ci.org/browse/JENKINS-41929

But now, everytime i restart the container or reload existing configuration through UI parameters are gone again and my workaround to abort the first build doesn't work anymore because it checks for the build number 1:

script {
if ('1'.equals(env.BUILD_NUMBER) && currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause') != null) {
currentBuild.displayName = 'Parameter loading'
currentBuild.description = 'Please restart pipeline'
currentBuild.result = 'ABORTED'

error 'Stopping initial manually triggered build as we only want to get the parameters'

Any ideas on how I can extend my workaround or better how to avoid removing existing job parameters when reloading existing configuration?
I don't know if this can be considered a bug or an enhancement request for JCasC to not remove those job parameters.
Any help is appreciated.


You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/WRZAIQ.I9W7CPAM6YSS%40gmail.com.