Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48744

Hidden stage are not executed after restarting Jenkins

      I use Declarative Pipeline and Multibranch pipeline job.Every time after restarting Jenkins due to plugin upgrade,the hidden stage 'Declarative: Checkout SCM' in Declarative Pipeline will not be executed and will be skipped.As a result, new changes can not be fetched from the git repository.But when I clicked 'Scan Multibranch Pipeline Now' manually, it fetched changes.

      In the attachment screenshot 'first', build worked fine and General SCM in it. In the attachment screenshot 'second', General SCM was lost and it did not fetch new changes.

        1. first.png
          first.png
          125 kB
        2. second.png
          second.png
          123 kB

          [JENKINS-48744] Hidden stage are not executed after restarting Jenkins

          Andrew Bayer added a comment -

          Can you please provide your Jenkinsfile that reproduces this?

          Andrew Bayer added a comment - Can you please provide your Jenkinsfile that reproduces this?

          Alan Yang added a comment -

          abayer Here's my Jenkinsfile that reproduces this:

          @Library('flow-pipeline@develop') _
          
          pipeline {
            agent any
            triggers {
              pollSCM('H/2 * * * *')
            }
            tools {
              jdk 'jdk8'
            }
            stages {
              stage('Build') {
                steps {
                  mBuild dynamicScript: false
                }
              }
            }
            post {
                always {
                  sendNotifications currentBuild.result
                }
            }
          }
          

          Alan Yang added a comment - abayer Here's my Jenkinsfile that reproduces this: @Library( 'flow-pipeline@develop' ) _ pipeline { agent any triggers { pollSCM( 'H/2 * * * *' ) } tools { jdk 'jdk8' } stages { stage( 'Build' ) { steps { mBuild dynamicScript: false } } } post { always { sendNotifications currentBuild.result } } }

          Alan Yang added a comment -

          abayer

           mBuild:

          def call(Map param = [:]) {
            def branch = param.get('skipBranch', [])
            def currentBranch = env.BRANCH_NAME
            if (branch.any { "${it}" == "${currentBranch}"}) {
              currentBuild.result = 'ABORTED'
              echo "Abort this due to current as same skipBranch ${branch}"
              error("Skip build branch ${currentBranch}")
            }
          
            def dynamicScript = param.get('dynamicScript', false)
            def script = "${param.script ?: 'clean install -Dmaven.test.skip=true'}"
            if (dynamicScript) {
              def inputParam = input(
                  message: "Please input script",
                  parameters: [string(defaultValue: '', description: '', name: 'script')]
              )
              script = inputParam
            }
          
            def publish = param.get('publish', true)
            script = commonVars.mavenCliOpts + ' ' + script
          
            artifactoryInMaven {
              runScript = script
              deployArtifacts = publish
              publishBuild = publish
            }
          }
          

          Alan Yang added a comment - abayer  mBuild: def call(Map param = [:]) { def branch = param.get( 'skipBranch' , []) def currentBranch = env.BRANCH_NAME if (branch.any { "${it}" == "${currentBranch}" }) { currentBuild.result = 'ABORTED' echo "Abort this due to current as same skipBranch ${branch}" error( "Skip build branch ${currentBranch}" ) } def dynamicScript = param.get( 'dynamicScript' , false ) def script = "${param.script ?: 'clean install -Dmaven.test.skip= true ' }" if (dynamicScript) { def inputParam = input( message: "Please input script" , parameters: [string(defaultValue: '', description: ' ', name: ' script')] ) script = inputParam } def publish = param.get( 'publish' , true ) script = commonVars.mavenCliOpts + ' ' + script artifactoryInMaven { runScript = script deployArtifacts = publish publishBuild = publish } }

          Andrew Bayer added a comment -

          I can't reproduce this with an older core - what version of Jenkins are you running?

          Andrew Bayer added a comment - I can't reproduce this with an older core - what version of Jenkins are you running?

          Andrew Bayer added a comment -

          Could you check your Jenkins master logs to see if you see anything like described in JENKINS-40862?

          Andrew Bayer added a comment - Could you check your Jenkins master logs to see if you see anything like described in JENKINS-40862 ?

          Andrew Bayer added a comment -

          I'm pretty certain this is the same thing as JENKINS-48571, which I have a PR up for.

          Andrew Bayer added a comment - I'm pretty certain this is the same thing as JENKINS-48571 , which I have a PR up for.

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.

            abayer Andrew Bayer
            xy_alan Alan Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: