Return a list of values from Python Script to Jenkins Pipeline
Since you're using the Pipeline DSL, you can use Groovy to process the result of the call to bat
pipeline {
agent any
steps {
step('Get Build Numbers') {
script {
def version_numbers = bat(script: 'python get_version_numbers.py', returnStdout: true)
def versions_as_array = version_numbers.split('\n')
}
}
}
}
From there, it's a matter of generating the build steps and wrapping them in a parallel block. For that, take a look at this answer: Ideas to implement dynamic parallel build using jenkins pipeline plugin
Get the ouput result for a python script in a Jenkinsfile pipeline groovy
stage('Deployment on FTP') {
steps {
script {
env.WAR_NAME = sh(script: "python scripts-ci/scripts/build/front/scripts/lib/war_name.py ${customerProfileId} ${FORCE_CUSTOMER_NAME}", returnStdout: true).toString().trim()
}
}
}
Here is the code of my current Jenkinsfile working (scripts-ci beeing the folder when I've clone my python scripts needed.
stage("Git checkout") {
steps {
dir("scripts-ci") {
git branch: "${GIT_BRANCH_CI}",
credentialsId: "${GIT_CREDENTIALS_ID}",
url: "${GIT_URL_CI}"
}
}
}
Related Topics
Hiding Axis Text in Matplotlib Plots
Looping in Python: Modify One Column Based on Values in Other Columns
How to Convert Column With Dtype as Object to String in Pandas Dataframe
Pandas - Calculate Average of Columns With Condition Based on Values in Other Columns
Python) I Wanna Add Two Lists Which Are Different Order of Len
Finding the Two Closest Numbers in a List Using Sorting
Flask Installed, But Modulenotfounderror: No Module Named 'Flask'
Most Efficient Way to Find Mode in Numpy Array
Check If File Has a CSV Format With Python
Importerror: No Module Named Psycopg2 After Install
How to Read from S3 in Pyspark Running in Local Mode
How to Find the Maximum Consecutive Occurrences of a Number in Python
How to Correct Typeerror: Unicode-Objects Must Be Encoded Before Hashing