Skip to content

Commit

Permalink
[BXMSPROD-2019] wait for seed job execution (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
lampajr committed Jun 26, 2023
1 parent 9f2ae9e commit 7e8b83f
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions dsl/seed/jenkinsfiles/Jenkinsfile.prod.prepare
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,39 @@ pipeline{
script {
println "Updating projects versions"

String jobName = "${getEcosystemProductizedBranch()}/setup-branch/0-setup-branch"
def prodBranch = getEcosystemProductizedBranch()
String jobName = "${prodBranch}/setup-branch/0-setup-branch"
List jobParams = []
jobParams.add(booleanParam(name: 'DEPLOY_ARTIFACTS', value: false))
// here we could have a variable number of params
getProjectUpdateVersionKeys().each{ p ->
jobParams.add(stringParam(name: p.key.replace('_UPDATE', ''), value: p.value))
}

echo "Build ./${jobName} with parameters ${jobParams}"
if (!isDryRun()) {
def job = build(job: "./${jobName}", parameters: jobParams, wait: true, propagate: false)
if (job.result != 'SUCCESS') {
unstable("Update projects version on repositories was not successful")
def job = [:]
try {
// Retry 20 times every 5 min in order to assure seed job ran
retry(20) {
sleep 300
echo "Build ./${jobName} with parameters ${jobParams}"
job = build(job: "./${jobName}", parameters: jobParams, wait: true, propagate: false)
}

if (job.result != 'SUCCESS') {
unstable("Update projects version on repositories was not successful")
}
} catch (err) {
unstable("Error executing the ${prodBranch} setup job ...")
String msg = "ERROR: Setup branch job on newly created release branch '${prodBranch}' was unsuccessful."
if(job) {
msg += "\nPlease review job ${job.absoluteUrl}..."
}
sendNotification(msg)
}
} else {
// dry run - just print the job name and params
echo "Build ./${jobName} with parameters ${jobParams}"
}
}
}
Expand Down

0 comments on commit 7e8b83f

Please sign in to comment.