运行 python 詹金斯脚本
Run python script in jenkins
我想使用 Jenkinsfile 运行 来自 Jenkins 的 python 脚本。有什么方法可以直接从 Jenkinsfile 中 运行 它吗?
我在 Jenkins 中找到 python 插件 (Click Here) 到 运行 一个脚本,但是这个插件没有合适的文档.如果有人解释如何将此插件与 Jenkinsfile 集成,那将非常有帮助。
Adds the ability to execute python scripts as build steps. Other than
that, this plugin works pretty much like the standard shell script
support
根据插件的文档。虽然我没有通过管道使用这个插件,但从工作的角度来看,你必须提供 .py 脚本(文件名和路径),就像你为 shell/powershell 脚本提供的一样。
同样,即使对于 python,您也将在节点上执行脚本,该节点将是 Linux 或 Windows。
所以,它会像下面这样工作:
stage('build') {
steps {
sh 'python abc.py'
}
}
参考资料:https://www.jenkins.io/doc/pipeline/tour/hello-world/
寻找 "Python" 街区。
我想使用 Jenkinsfile 运行 来自 Jenkins 的 python 脚本。有什么方法可以直接从 Jenkinsfile 中 运行 它吗?
我在 Jenkins 中找到 python 插件 (Click Here) 到 运行 一个脚本,但是这个插件没有合适的文档.如果有人解释如何将此插件与 Jenkinsfile 集成,那将非常有帮助。
Adds the ability to execute python scripts as build steps. Other than that, this plugin works pretty much like the standard shell script support
根据插件的文档。虽然我没有通过管道使用这个插件,但从工作的角度来看,你必须提供 .py 脚本(文件名和路径),就像你为 shell/powershell 脚本提供的一样。
同样,即使对于 python,您也将在节点上执行脚本,该节点将是 Linux 或 Windows。
所以,它会像下面这样工作:
stage('build') {
steps {
sh 'python abc.py'
}
}
参考资料:https://www.jenkins.io/doc/pipeline/tour/hello-world/
寻找 "Python" 街区。