Is it possible to make a parameterized scripted pipeline in Jenkins by listing the parameters in actual script, not in job config

后端 未结 4 626
情深已故
情深已故 2021-02-12 14:49

In a declarative pipeline, I can specify the parameter that the pipeline expects right in the pipeline script like so:

pipeline {
   parameters([
    string(name         


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-02-12 15:13

    I highly recommend using the "Snippet Generator" for first time use of figuring this out. It will allow you to use a GUI that looks maybe exactly like the snapshot you shared above, to fill out the settings you want, and generate the appropriate syntax. For this question in-particular, select the sample step "properties: Set job properties" from the Snippet Generator

    You can access the "Snippet Generator" from any Jenkins server by going to the /pipeline-syntax endpoint.

    For more info on the snippet generator see: https://jenkins.io/doc/book/pipeline/getting-started/#snippet-generator

提交回复
热议问题