How I pass params from Jenkins to build.gradle?

前端 未结 3 1087
攒了一身酷
攒了一身酷 2020-12-22 00:44

I want to pass value to my build.gradle file through jenkins (build with params).

I have a String and I need to use this String params to make my release ?

3条回答
  •  天命终不由人
    2020-12-22 01:07

    In General configuration set "This project is parameterized" checkbox to true, and set String/stash/choice/int parameter as you wish for , the name field is your variable name. In your dev project , in the gradle file just grab this variable by calling simple getEnv method.

    String inputFromJenkins = System.getenv('VARIABLE_NAME')
    println('VARIABLE_NAME = ' + inputFromJenkins)
    

    for extra documentation: gradle env variables documentation

提交回复
热议问题