I have a Jenkinsfile and it has two parallel stages. In one stage I want to call a function from python script.
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 script:
class Build:
def A():
try:
print("Build stage")
return True
except Exception as e:
print(str(e))
I want to call this A() function there in my Jenkinsfile and want to get return value there. Is there any mechanism to do this.