How do I use Jenkins Pipeline properties step?

后端 未结 2 1692
天涯浪人
天涯浪人 2020-12-05 12:34

I am studying capabilities of Jenkins Pipeline:Multibranch. It is said that a recently introduced properties step might be useful there, but I can\'t catch how

2条回答
  •  一向
    一向 (楼主)
    2020-12-05 13:33

    Using properties with explicit method syntax will work, i.e.:
    properties( [ ... ] ) rather than properties [ ... ]

    Alternatively, it will work without if you specify the parameter name, e.g.:

    properties properties: [ ... ]
    

    For example defining three properties is as easy as :

    properties([
      parameters([
        string(name: 'submodule', defaultValue: ''),
        string(name: 'submodule_branch', defaultValue: ''),
        string(name: 'commit_sha', defaultValue: ''),
      ])
    ])
    
    /* Accessible then with : params.submodule, params.submodule_branch...  */
    

提交回复
热议问题