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

pipeline-build-step-plugin: "triggeredBy UpstreamCause" when condition in declarative pipeline is broken

XMLWordPrintable

      We upgrade the plugin lately from 2.13 to 2.15 and noticed that build steps in our declarative where not triggered anymore. Then we figured out that all these build steps have in common that they use the triggeredBy 'UpstreamCause' condition which we guess is broken because of JENKINS-60995. Probably the new class implemented by this is not taken into consideration for evaluating the when condition or there is some non-compatibility between this and the original class. This unfortunately has a bigger impact for us as we are checking the trigger in our jobs if it was by a user or by a upstream job. An example of this would be

       

      pipeline {
          agent any    
          parameters {
              booleanParam(name: 'FORCE_RUN', defaultValue: false)
          }
          stages {
              stage("Job check") {
                  when {
                      not {
                          anyOf {
                              triggeredBy 'UpstreamCause'
                              expression { return  params.FORCE_RUN }
                          }
                      }
                  }
                  steps {
                      script {
                          currentBuild.result = 'NOT_BUILT'
                          error('Please use the FORCE_RUN parameter to start manually, or start the deployment from upstream')
                      }
                  }
              }
              stage('Initialization of the pipeline') {
                  steps {
                      echo "Job triggered successfully"
                  }
              }
          }
      }
      

       

            Unassigned Unassigned
            seros Erik Müller
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: