基本上我想在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步骤本身正在做我想要的事情。
答案 0 :(得分:2)
大声笑,我只需将其添加为参数:
def call(config, body) {
// config is a map of the parameters
}