Pipeline build expects multiple values for a parameter

26 views
Skip to first unread message

Ramanathan Muthaiah

unread,
Apr 28, 2017, 10:24:42 AM4/28/17
to Jenkins Users
Hello,

Am using parameters( [ . . . ] ) inside the pipeline script to define the values for the various parameters. These params are used while invoking packer tool.

properties([
  parameters
([
   
string(name: 'region',      defaultValue: 'us-west-2',       description: ''),
    text
(defaultValue: '"us-west-2, us-west-1"', description: '', name: 'ami_regions')
 
])
])


For the packer tool, among other variables, I need to pass multiple region names, like this,

packer -var ami_regions="us-west-2, us-west-1" . . .

Am able to access them like, ${params.ami_regions} but then the double quote is missing and the input to packer cmd is partial i.e. us-west-1 is missed out.

Does anybody know why is this ? And, is there a better way to handle this, via some groovy script embedded within the pipeline ?

--
regards
Ram

Ramanathan Muthaiah

unread,
Apr 30, 2017, 1:21:31 AM4/30/17
to Jenkins Users
 
Solution:

Retaining the same config values in the "properties" (step ?), I was able to get over this problem with only minor change to this:

text(defaultValue: 'us-west-2,us-west-1', description: 'AWS regions to copy AMI', name: 'ami_regions')

Removed the single blank space between the two values and double quotes at the start and end.

/Ram
Reply all
Reply to author
Forward
0 new messages