Hi,
I would like to change the number of stage and that some of them would be parallel.
Currently I have this script, the important is a the end in the “stage(‘Tests’)” with the test category 1 and category 2.
pipeline {
agent { label 'my_agent'}
stages {
stage('stage_1') {
steps {
script {
sh '''
echo "stage_1"
'''
}
}
}
stage('stage_2') {
agent { node { label 'agent_stage2' } }
when {
expression {
return (params.PREBUILT_BIN_PATH != '');
}
}
steps {
dir ('client_binaries') {
script {
if (!clientBinariesExist(VERSION)) {
logger.info()
sh '''
echo
'''
}
logger.info("stage_2")
}
}
}
}
stage('Tests') {
parallel {
stage('tests category 1') {
steps {
dir('build_ct_m') {
script {
println("Running test cat 1")
}
}
}
}
stage('tests category 2') {
steps {
dir('build_ct_m') {
script {
println("Running test cat 2")
}
}
}
}
}
}
}
}
Currently test category 1 and 2 are well run in parallel. But now I would like to have a dynamic number of test (ie dynamic number of stage ‘test category X’) that will depend on a given parameter given to the job.
I tried for for loop after the parallel keyword, but groovy was complaining that he wants a stage declaration at this point.
Thank.