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

Pipeline: If job fails it will run again on next poll.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • p4-plugin
    • P4-Plugin 1.9.3
      Jenkins 2.138.1

      When a job detected by polling fails, it will run again the next time polling runs even when there are no new changes since last poll. For example.

      (1) Build works.
      (2) No new changes = Next poll no execution.
      (3) New change made = Next poll execution.
      (4) Build fails = Next poll execution.
      (5) Build fails = Next poll execution.
      (6) Build works = Next poll no execution.

       

      Reproductions steps:

      (1) Create a pipeline job with the following Jenkinsfile and set it up to poll every minutes (or use the PollNow plugin):

      pipeline {  agent { label 'master' }
        
        stages {
          stage("Run script") {
            steps {
              script {
              def failJob = input(message: 'Do you wish this job to work?', 
      	                ok: 'OK', 
                              parameters: [booleanParam(defaultValue: true, 
                              description: 'If you want this to fail untick yes and click YES',
                              name: 'Yes?')])	   
                 echo "Input Result:" + failJob
                 if (failJob == false)
                 {
                    sh 'Arghhhhh'
                 }
      	   echo "P4_CLIENT is:"
      	   echo env.P4_CLIENT
              }
            }
          }
        }
      }
      
      

      (2) Submit a changelist to the polled view.

      (3) Wait for job to run, go into the console for the job execution and click on 'Input requested', Untick 'Yes?' then click 'OK'. Job will be marked as 'FAILURE'.

      (4) Wait for next poll or click 'Poll Now'. Job will trigger again.

      (5) On 'Input requested just click 'OK'. Job will be marked as 'SUCCESS'.

      (6) Wait for next poll or click 'Poll Now'. Job will NOT trigger again.

       

       

            cbopardikar Charusheela Bopardikar
            p4karl Karl Wirth
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: