jenkinsci / java-client-api

A Jenkins API client for Java
MIT License
901 stars 470 forks source link

[Query] How to pass parameters to input steps via API #369

Open SudhiHathwar opened 5 years ago

SudhiHathwar commented 5 years ago

Hi, I was using Jenkins Java client to trigger automation builds externally.

I was able to trigger the build with parameters, but once build is triggered, we need to provide few input parameters like which environment do you like to run your build, On which branch do you like run your tests etc; which are mentioned in Jenkins file.

Is there any way we can pass the input parameters to build once it has been triggered?

These parameters are dynamic and few parameters depend on the input we give during triggering the build. Is there any way to get the list of input parameters that are required?

Any help would be appreciated.

Thanks in advance.

SudhiHathwar commented 5 years ago

@khmarbaise Can you please provide your input?

Thanks

llsachinll commented 5 years ago

@SudhiHathwar I think we can only provide parameters before building the job .You can pass all the parameters before the build and pass them to the mvn command. Can you share some screenshots of job you are working on?

khmarbaise commented 5 years ago

If a build is triggered it's already running and at that point your can't add parameters to it. You have to do that before you trigger the build...which means you have to use methods like:

    public QueueReference build(Map<String, String> params) ...

see in Job.java