How to pass parameters to Hudson job's shell commands
Asked Answered
L

3

13

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.

Lissome answered 18/7, 2014 at 15:25 Comment(0)
B
18

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}
Bemoan answered 18/12, 2015 at 22:59 Comment(1)
I see that jenkins dont touch the case. If I give a lower-case parameter it will remains lower-case variablePartiality
M
0

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

Magic answered 18/7, 2014 at 17:21 Comment(0)
T
0

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}.

Toilet answered 24/9, 2021 at 8:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.