Tim
Tim

Reputation: 2066

Add a map into jenkins build flow plugin as a parameters

I have a question about jenkins build flow plugin.

There is a default value called params in build flow dsl which looks like a map.

What I want to do is pass this map to the jobs I want to build later, however, build flow dont accept a map as a parameters. For example:
build("test_job", params)

The most stupid way I know is just paste all of them one by one, like, build("test_job", "Key1":params[1], "key2":"params[2]")

Any better idea for this case?

Br,
Tim

Upvotes: 0

Views: 1910

Answers (3)

Ayman Alkhalil
Ayman Alkhalil

Reputation: 31

You can do this by archiving your map from project 1 and copy it using this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin

Or you can use shared folder using the plugin: https://wiki.jenkins-ci.org/display/JENKINS/CopyArchiver+Plugin

Upvotes: 0

Benjamin P
Benjamin P

Reputation: 11

The order is the key here! You can do this (at least it works for me), use the map of parameters as the first argument :

job_params = [:]
job_params['BRANCH'] = 'The Branch Name'

build( job_params, 'pipelinetester' )

And it works!

Upvotes: 1

mahinlma
mahinlma

Reputation: 1248

Try this method

build("jobname", parameter_name:"your parameter value")

Example :

In your case if you are using name as parameter and your value "abc" then use

build ("job-name", name:"abc")

Upvotes: 0

Related Questions