Conditional BuildStep Git Tag Token Macro

403 views
Skip to first unread message

Sverre Moe

unread,
Feb 24, 2015, 4:02:31 AM2/24/15
to jenkins...@googlegroups.com
I have defined a conditional build step that should check for a given git tag before executing a shell script.
Using the Conditional BuildStep Plugin

Exception caught evaluating condition: [org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Undefined parameter tag in token GIT_REVISION], action = [Fail the build]
Build step 'Conditional step (single)' changed build result to FAILURE
Build step 'Conditional step (single)' marked build as failure

My Configuration:
Conditional Step (single) -> Boolean -> Token = ${GIT_REVISION, tag="v1.0.0"}

I have checked the tag v1.0.0 does exist in the repository.

I have installed the necessary Git Parameter Plugin needed to access this Token Macro in Conditional BuildStep.

Sverre Moe

unread,
Feb 25, 2015, 9:57:06 AM2/25/15
to jenkins...@googlegroups.com
I got what I wanted. Perhaps it's not an elegant solution:

1) The build begins by first running a Groovy script. It checks if a Git tag exists. It then puts the property TAGGED=true/false into a properties file.
2) Then I use "Inject Environment Variables" from this properties file.
3) I use this environment property in Conditional BuildStep:
  Conditional Step (single) -> Not -> Boolean -> Token = ${ENV,TAGGED}

Would be much better if the Git Parameter Plugin could be used instead.
Reply all
Reply to author
Forward
0 new messages