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

SCM Skip doesn't abort my docker builds until much later

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • scmskip-plugin
    • None
    • Latest LTS Jenkins & plugins
      SCM Skip v1.01

      My declarative pipeline builds don't get aborted until much later, for some reason that I don't understand. My Jenkinsfile looks something like:

      pipeline {
      
        // Any SkyView Docker agent can build this.
        agent {
          docker {
           label 'docker-host'
            image '...'
            ...
          }
        }
      
        options {
          timestamps()
          disableConcurrentBuilds()
          buildDiscarder ...
        }
      
        environment {
          ...
        }
      
        stages {
      
          stage('Prepare') {
            steps {
              // Set some options that can't be done in multibranch config GUI, like code browser
              checkout(...)
              scmSkip(deleteBuild: true, skipPattern: '.*\\[(ci skip|skip ci)\\].*')
            }
          }
      
          stage ('Unit Tests') {
            steps {
              ...
            }
          }
      
          stage ('Build') {
            steps {
              // run the long build script that also  commits build number/version files with "[skip ci]"
            }
          }
      
          stage ('Integration Tests') {
            steps {
              ...
            }
          }
      
        } // stages
        // Post-build steps
        post {
          always {
            // Notify rules
          }
          success {
            archiveArtifacts ...
            // Trigger downstream job(s)
          }
        }
      }
      

      My build output looks something like:

      ...
      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on <server> in <workspace>
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Declarative: Checkout SCM)
      [Pipeline] checkout
      ...
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] withDockerRegistry
      $ docker login -u gitlab+deploy-token-35921 -p ******** https://registry.gitlab.com/dynonavionics/docker
      WARNING! Using --password via the CLI is insecure. Use --password-stdin.
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Declarative: Agent Setup)
      [Pipeline] sh
      + docker pull ...
      Status: Image is up to date for <image>
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] sh
      + docker inspect ...
      [Pipeline] withDockerContainer
      <server> does not seem to be running inside a container
      $ docker run ...
      [Pipeline] {
      [Pipeline] withCredentials
      ...
      [Pipeline] {
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] timestamps
      [Pipeline] {
      $ docker top ...
      [Pipeline] stage
      [Pipeline] { (Prepare)
      [Pipeline] checkout
      cleanup, update, etc...
      [Pipeline] scmSkip
      11:39:48.620  SCM Skip: Pattern .*\[(ci skip|skip ci)\].* matched on message: Preparing for version 15.5.A3, build 05321. [skip ci]
      [Pipeline] }
      [Pipeline] stage
      [Pipeline] { (Unit Tests)
      ...
      [Pipeline] }
      [Pipeline] stage
      [Pipeline] { (Build)
      ... running the entire long build script successfully
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Integration Tests)
      [Pipeline] echo
      11:52:38.374  TODO: Subsume down-stream test jobs and make this a complete pipeline!
      [Pipeline] }
      [Pipeline] stage
      [Pipeline] { (Declarative: Post Actions)
      ...[Pipeline] step
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // timestamps
      [Pipeline] }
      [Pipeline] // withEnv
      [Pipeline] }
      [Pipeline] // withCredentials
      [Pipeline] }
      

      As you can see, it continued with the entire build, but it just deleted it at the end instead of aborting. What am I doing wrong? Is that the behavior I should expect when I set deleteBuild: true? I assumed that it would abort the run and delete it...

            plavc Gregor PlavĨak
            bryceman Bryce Schober
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: