Reputation: 1098
I am trying to find a way to have Jenkins conditionally execute a build step based on the type of files that were included in the pull from SVN. That is, if the build included a change to any SQL files, I want to execute the 'database check' build step.
I have my SVN server set with a PostCommit script that calls Jenkins to start a build. This PostCommit script does inspect the type of files that were included in the commit and will call the appropriate Jenkins job based on the file types. However there are some scenarios where there is overlap, and having multiple Jobs for a single solution seems like a maintenance problem.
So far I have tried to use the Conditional BuildStep Plugin and I use a Regular Expression match condition using the expression ${CHANGES, showPaths=true}
. I got the idea for this expression from this SO answer.
Here's what the Conditional Step looks like:
When I attempt to execute this Job, I get the following Jenkins error which makes it sounds like the CHANGES
token is not supported:
Run condition [Regular expression match] enabling prebuild for step [BuilderChain]
Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'CHANGES' in '${CHANGES, showPaths=true}'], action = [Fail the build]
Build step 'Conditional steps (multiple)' changed build result to FAILURE
Build step 'Conditional steps (multiple)' marked build as failure
Upvotes: 4
Views: 2902
Reputation: 468
This macro ${CHANGES, showPaths=true}
works only with email notification plugin.
For you task better to setup additional checkout behavior. We use it with GIT i think SVN working the same way.
Upvotes: 1