我如何在詹金斯(Jenkins)中创建一个具有参数和body的共享库



基本上我想在詹金斯(Jenkins

kPod(label: label){
    body
}

进入:

podTemplate(label: label, //use argument as label
containers: [containerTemplate(name: 'jnlp', image: 'someImage', args: '${computer.jnlpmac} ${computer.name}')],
volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]) {
    //put body here
}

但是,我看到的所有示例都可以允许您访问参数或身体,但不能同时访问。文档也没有提及:https://jenkins.io/doc/book/pipeline/shared-libraries/

,但显然是可能的,因为podtemplate步骤本身正在做我想要的。

大声笑,我只需要将其添加为一个参数:

def call(config, body) {
    // config is a map of the parameters
}

最新更新