diff --git a/jenkins/check-for-build.jenkinsfile b/jenkins/check-for-build.jenkinsfile index 6434954d89..204c303af8 100644 --- a/jenkins/check-for-build.jenkinsfile +++ b/jenkins/check-for-build.jenkinsfile @@ -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}" + ) } } }