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

Hidden stage are not executed after restarting Jenkins

    Details

    • Similar Issues:

      Description

      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.

        Attachments

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

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            Can you please provide your Jenkinsfile that reproduces this?

            Show
            abayer Andrew Bayer added a comment - Can you please provide your Jenkinsfile that reproduces this?
            Hide
            xy_alan Alan Yang added a comment -

            Andrew Bayer 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
                  }
              }
            }
            
            Show
            xy_alan Alan Yang added a comment - Andrew Bayer 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 } } }
            Hide
            xy_alan Alan Yang added a comment -

            Andrew Bayer

             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
              }
            }
            
            Show
            xy_alan Alan Yang added a comment - Andrew Bayer  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 } }
            Hide
            abayer Andrew Bayer added a comment -

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

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

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

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

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

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

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: