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

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

    • 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...

          [JENKINS-57265] SCM Skip doesn't abort my docker builds until much later

          ipleten added a comment -

          I have the same issue with kubernetes plugin.

          ScmSkip matches the pattern but still continues with pipeline!

          ipleten added a comment - I have the same issue with kubernetes plugin. ScmSkip matches the pattern but still continues with pipeline!

          ipleten added a comment - - edited

          I can't find any non-"hacky" approach how to exclude commit from build on message content.  None of plugins seems work with multibranch pipelines.

          ipleten added a comment - - edited I can't find any non-"hacky" approach how to exclude commit from build on message content.  None of plugins seems work with multibranch pipelines.

          Mauro Rocha added a comment - - edited

          same happens for my project...

          ScmSkip matches the pattern but still continues with pipeline!

           

          SCM Skip: Pattern .[ci skip]. matched on message: Confirm skip [ci skip]

           

          Mauro Rocha added a comment - - edited same happens for my project... ScmSkip matches the pattern but still continues with pipeline!   SCM Skip: Pattern . [ci skip] . matched on message: Confirm skip [ci skip]  

          davidkarlsen added a comment -

          The plugin is essentially broken as it cannot do the one thing it is designed to do.
          This issue has had "in progress" since May - are anyone working on it - or is the plugin abandoned?

          davidkarlsen added a comment - The plugin is essentially broken as it cannot do the one thing it is designed to do. This issue has had "in progress" since May - are anyone working on it - or is the plugin abandoned?

          X Man added a comment -

          Guys, really, thanks for the plugin, but come on, fix it already or at least remove In Progress status, be decent.

          In the meantime, for those unlucky folks in same great pain as I am, here's a hint on how to apply a band aid, to each stage add manual check: 

          when {
            not { changelog '\\[ci skip\\]' }
            beforeAgent true
          }
          

          But be wary, "changelog" condition checks for the whole changeset, so if at least one commit in the changeset contains [ci skip] it will skip the stage. SCM Skip plugin on the other hand checks only the last commit message.

           

          X Man added a comment - Guys, really, thanks for the plugin, but come on, fix it already or at least remove In Progress status, be decent. In the meantime, for those unlucky folks in same great pain as I am, here's a hint on how to apply a band aid, to each stage add manual check:  when { not { changelog '\\[ci skip\\]' } beforeAgent true } But be wary, "changelog" condition checks for the whole changeset, so if at least one commit in the changeset contains [ci skip] it will skip the stage. SCM Skip plugin on the other hand checks only the last commit message.  

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

              Created:
              Updated:
              Resolved: