Chun ping Wang
Chun ping Wang

Reputation: 3929

How to pass parameters to Hudson job's shell commands

I have a Hudson job that execute shell script on a remote server.

Its shell command is:

/usr/bin/deployWar.sh ${warfileName}

I marked this build as parameterized, and added a string parameter:

name: warFileName
default value: none
description: name of war file

When I run it, the parameter gets assigned, but it get passed into the shell script.

Upvotes: 13

Views: 45512

Answers (3)

velval
velval

Reputation: 3312

For me the accepted answer did not work. ${WARFILENAME} using the brackets did not find the parameter. The way it seems to work only for shell scripts execution in Jenkins is $WARFILENAME (without the brackets).

This tutorial helped.

Everywhere else in jenkins options used ${WARFILENAME}.

Upvotes: 0

Perspectivus
Perspectivus

Reputation: 990

Parameterized Build Jenkins plugin documentation states that

all the environment variables added by parameters are in upper case

In your case this should work:

/usr/bin/deployWar.sh ${WARFILENAME}

Upvotes: 18

Slav
Slav

Reputation: 27485

There is nothing wrong in your approach. How do you know it's not passed to the shell script? The console log will show the "execute shell" command line.

Please paste the whole console log in here

Upvotes: 0

Related Questions