Karthik P
Karthik P

Reputation: 107

Unable to skip Jenkins Build by SCM Skip Plugin

I am working on a pipeline script in Jenkins to build the project based on a commit message. From Jenkins' forum, I noticed that we can use SCM skip plugin. I installed the plugin and added the below stage as the forum suggests:

scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')

When I commit a change with the following commit message:

git commit -m "[ci skip] Updated Audit Test Data Files with scan status"

The build is not skipped. It progresses with the other stages.

In console logs, I see the message

SCM Skip: Changelog is empty!

How do I construct the scmSkip call to skip the build when a commit message including "[ci skip]" is found? Are there alternatives that are easier to implement?

Thanks, Karthik P.

Upvotes: 5

Views: 2099

Answers (2)

fiveiron
fiveiron

Reputation: 3

Be sure you aren't skipping the scm default checkout (via skipDefaultCheckout true) on the node where the build is running.

pipeline {
    options {
        skipDefaultCheckout false
    }

    stages {
        stage('Check for Skip') {
            steps {
                scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')
            }
        }

...

Upvotes: 0

Timo
Timo

Reputation: 513

It's probably because you didn't checkout first the repository

Upvotes: 1

Related Questions