Master Disaster
Master Disaster

Reputation: 769

Execute gradle task with environment value

I have a jenkins pipeline and one of my step is input that I can provide some option. I create environment for this option to use it in another step. Another step means executing gradle task when name is conneceted with env value

env.OPTION = input message: 'Option', parameters: [string(name: 'Option', defaultValue: 'Value1', description: 'Value1/Value2')]

then I would like to have something like this:

sh './gradlew buildValue1'

Is there any option to do this that way:

sh './gradlew build+${env.OPTION}'

Upvotes: 0

Views: 120

Answers (1)

Master Disaster
Master Disaster

Reputation: 769

Solution, replace ' with " and remove +

sh "./gradlew build${env.OPTION}"

Upvotes: 1

Related Questions