我有一个Jenkinsfile,它有两个平行的阶段。在一个阶段,我想从python脚本中调用一个函数。
Jenkinsfile
pipeline {
agent any
stages {
stage('Main') {
parallel {
stage('Build') {
steps {
script {
********I want to call python function here ********
}
}
}
stage('Test'){
steps{
echo "It is a test stage."
}
}
}
}
}
}Python脚本:
class Build:
def A():
try:
print("Build stage")
return True
except Exception as e:
print(str(e))我想在Jenkinsfile中调用这个A()函数,并在那里获得返回值。有没有任何机制来做这件事。
发布于 2022-08-11 06:21:21
返回值
脚本{sh“变量= python python_script.py”}
https://stackoverflow.com/questions/63474649
复制相似问题