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

A pipeline with no stages that calls an external build does not show steps, but shows a "fake" stage

    Details

    • Similar Issues:
    • Epic Link:
    • Sprint:
      pannonian

      Description

      This is hard to explain so I will put an image attached.

      Basically, the current Jenkinsfile for blueocean has no stages, but it does call the ATH job towards the end.

      In the stage view things are correct (classic) as there are no stages. However, in blue ocean a "fake stage" which appears to be the dispatching of this external shows up as a stage in the stage graph. All steps as part of the build are also hidden. It is most odd.

      The job: https://ci.blueocean.io/blue/organizations/jenkins/blueocean/detail/master/415/pipeline

      (this should be showing a simple list of steps, no stages, and many more steps than that).

      The Jenkinsfile to see this:

      #!groovy
      
      // only 20 builds
      properties([buildDiscarder(logRotator(artifactNumToKeepStr: '20', numToKeepStr: '20'))])
      
      node {
        deleteDir()
        checkout scm
        configFileProvider([configFile(fileId: 'blueocean-maven-settings', targetLocation: 'settings.xml')]) {
      
        docker.image('cloudbees/java-build-tools').inside {
          withEnv(['GIT_COMMITTER_EMAIL=me@hatescake.com','GIT_COMMITTER_NAME=Hates','GIT_AUTHOR_NAME=Cake','GIT_AUTHOR_EMAIL=hates@cake.com']) {
            try {
              sh "mvn clean install -B -DcleanNode -Dmaven.test.failure.ignore -s settings.xml -Dmaven.artifact.threads=30"
              sh "node ./bin/checkdeps.js"
              sh "node ./bin/checkshrinkwrap.js"
              step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
              step([$class: 'ArtifactArchiver', artifacts: '*/target/*.hpi'])
      
              triggerATH();
            } catch(err) {
              currentBuild.result = "FAILURE"
            } finally {
              sendhipchat()
              deleteDir()
            }
          }
        }
      
        }
      }
      
      def triggerATH() {
          // Assemble and archive the HPI plugins that the ATH should use.
          // The ATH build can copy this artifact and use it, saving the time it
          // would otherwise spend building and assembling again.
          sh 'cd blueocean && mvn hpi:assemble-dependencies && tar -czvf target/ath-plugins.tar.gz target/plugins'
          archiveArtifacts artifacts: 'blueocean/target/ath-plugins.tar.gz'
      
          // Trigger the ATH, but don't wait for it.
          try {
              echo "Will attempt to run the ATH with the same branch name i.e. '${env.BRANCH_NAME}'."
              build(job: "ATH-Jenkinsfile/${env.BRANCH_NAME}",
                      parameters: [string(name: 'BLUEOCEAN_BRANCH_NAME', value: "${env.BRANCH_NAME}"),
                                   string(name: 'BUILD_NUM', value: "${env.BUILD_NUMBER}")],
                      wait: false)
          } catch (e1) {
              echo "Failed to run the ATH with the same branch name i.e. '${env.BRANCH_NAME}'. Will try running the ATH 'master' branch."
              build(job: "ATH-Jenkinsfile/master",
                      parameters: [string(name: 'BLUEOCEAN_BRANCH_NAME', value: "${env.BRANCH_NAME}"),
                                   string(name: 'BUILD_NUM', value: "${env.BUILD_NUMBER}")],
                      wait: false)
          }
      }
      
      def sendhipchat() {
          res = currentBuild.result
          if(currentBuild.result == null) {
            res = "SUCCESS"
          }
          message = "${env.JOB_NAME} #${env.BUILD_NUMBER}, status: ${res} (<a href='${currentBuild.absoluteUrl}'>Open</a>)"
          color = null
          if(currentBuild.result == "UNSTABLE") {
              color = "YELLOW"
          } else if(currentBuild.result == "SUCCESS" || currentBuild.result == null){
              color = "GREEN"
          } else if(currentBuild.result == "FAILURE") {
              color = "RED"
          }
          if(color != null) {
              hipchatSend message: message, color: color
          }
      }
      

        Attachments

          Issue Links

            Activity

            Hide
            michaelneale Michael Neale added a comment -

            Vivek Pandey I think this should be looked at once bismuth is in. This is a problem I think with the api ... needs investigation.

            Show
            michaelneale Michael Neale added a comment - Vivek Pandey I think this should be looked at once bismuth is in. This is a problem I think with the api ... needs investigation.
            Hide
            jamesdumay James Dumay added a comment -

            Michael Neale is this one still relevant?

            Show
            jamesdumay James Dumay added a comment - Michael Neale is this one still relevant?
            Hide
            jamesdumay James Dumay added a comment -

            Pre-bismuth issue

            Show
            jamesdumay James Dumay added a comment - Pre-bismuth issue

              People

              • Assignee:
                michaelneale Michael Neale
                Reporter:
                michaelneale Michael Neale
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: