Skip to content

Commit

Permalink
Add invalid job case & improve error handling in check-for-build (#1590)
Browse files Browse the repository at this point in the history
* Add invalid job case in check-for-build
* Remove catch block; pass TEST_MANIFEST for all jobs

Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler authored Feb 3, 2022
1 parent 484f6bc commit 84c160e
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions jenkins/check-for-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,20 @@ pipeline {
if (sha.exists) {
echo "Skipping, ${sha.path} already exists."
} else {
try {
// Currently only opensearch build takes an additional test manifest parameter
if (TARGET_JOB_NAME == 'distribution-build-opensearch') {
build job: "${TARGET_JOB_NAME}", parameters: [
string(name: 'INPUT_MANIFEST', value: "${INPUT_MANIFEST}"),
string(name: 'TEST_MANIFEST', value: "${TEST_MANIFEST}")
], wait: true
} else if (TARGET_JOB_NAME == 'distribution-build-opensearch-dashboards') {
build job: "${TARGET_JOB_NAME}", parameters: [
string(name: 'INPUT_MANIFEST', value: "${INPUT_MANIFEST}")
], wait: true
}
echo "Build succeeded, uploading build SHA for that job"
buildUploadManifestSHA(
inputManifest: "manifests/${INPUT_MANIFEST}",
jobName: "${TARGET_JOB_NAME}"
)
} catch (err) {
echo "${TARGET_JOB_NAME} failed"
if (TARGET_JOB_NAME != 'distribution-build-opensearch' &&
TARGET_JOB_NAME != 'distribution-build-opensearch-dashboards') {
error "Job ${TARGET_JOB_NAME} is invalid"
}
build job: "${TARGET_JOB_NAME}", parameters: [
string(name: 'INPUT_MANIFEST', value: "${INPUT_MANIFEST}"),
string(name: 'TEST_MANIFEST', value: "${TEST_MANIFEST}")
], wait: true

echo "Build succeeded, uploading build SHA for that job"
buildUploadManifestSHA(
inputManifest: "manifests/${INPUT_MANIFEST}",
jobName: "${TARGET_JOB_NAME}"
)
}
}
}
Expand Down

0 comments on commit 84c160e

Please sign in to comment.