【发布时间】:2021-07-13 01:03:32
【问题描述】:
我注意到JSL 脚本只能在 Jenkins Master 上执行,是否可以在 Jenkins 代理上运行 JSL 脚本?
我的流水线中有多个阶段,我希望在不同的 Jenkins 代理节点上运行这些阶段。
我使用 JSL 的主要动机是 end-to-end Pipeline testability 在开发过程中使用“重放”,我可以在其中修改 Jenkinsfile 以及来自 JSL 的脚本。
这是我的管道的 sn-p --
pipeline {
agent { label 'scdc-generic-w10x64' }
options {
timestamps()
}
stages {
stage('Log ip') {
steps {
script {
bat "ipconfig -all" // *** Gets executed on Jenkins Agent ***
foo = jsl.foo.new(this) // foo is a Groovy class in JSL
foo.logIpAddress() // *** Gets executed on Jenkins Master ***
}
}
}
}
post {
always {
cleanWs()
}
}
}
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-shared-libraries