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

"retry" not working in declarative

XMLWordPrintable

      Have job defined ~like this:

      stages {
              stage('Run things') {
                  options {
                      timeout(time: 1, unit: 'HOURS')
                      retry(3)
                  }
                  agent {
                      docker {
                          image "mydocker"
                          args '-v /dev/shm:/dev/shm -u root --ulimit nofile=8000:8000' // otherwise Chrome crashes running out of memory, or SauceLabs complains
                          registryUrl 'https://registry.hub.docker.com'
                          registryCredentialsId 'dockerHub'
                      }
                  }
      
                  environment {
                      TEST_SUITE = "${params.testSuite}"
                  }
      
                  steps {
                      sh '''
                      nohup /opt/bin/entry_point.sh &
                      sleep 10
                      '''
                      // run tests
                      sh 'make -C integration test-suite'
                      // save results
                      stash name: 'allure-results', includes: 'integration/allure-results/*'
                  }
                  post {
                      always {
                          junit 'integration/logs/*.xml'
                          archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/shots/*.*'
                      }
                      unsuccessful {
                          archiveArtifacts allowEmptyArchive: true, artifacts: 'integration/shots/*.*'
                          cleanWs()
                      }
                      success {
                          cleanWs()
                      }
                  }
              }
          }
      

      and if the steps fail - the stage is not rerun (it only runs once)

            abayer Andrew Bayer
            mkj Michal Matyjek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: