fetching parameters from a jenkins job in java code

前端 未结 3 884
广开言路
广开言路 2021-01-22 05:44

I have a parameterised jenkins job that is accessing my plugin. Inside plugin\'s code in java, i require these parameters using which i have to trigger another job in jenkins. I

3条回答
  •  清酒与你
    2021-01-22 05:51

    One of the option to achieve this is "PASS and GET AS ARGUMENT" in your java code.

    Jenkins's variables value can be retrieved like this.

    urlValue=${url} 
    

    Then pass this value in java code. This will be structure of your Execute shell in job configuration.

    #!/bin/bash -e
    urlValue=${url} 
    # run java code
    java  $urlValue
    

提交回复
热议问题