Skip to content

Commit

Permalink
Refactor triggering integ-test and enable for RPM, debian and windows
Browse files Browse the repository at this point in the history
Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya committed Jan 24, 2024
1 parent fec0355 commit 5f10c2f
Showing 1 changed file with 47 additions and 61 deletions.
108 changes: 47 additions & 61 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,7 @@ pipeline {
echo "artifactUrl (linux, x64, tar): ${artifactUrl}"

parallel([
'integ-test': {
Boolean skipIntegTests = (INTEG_TEST_JOB_NAME == '' || TEST_MANIFEST == '' || buildManifestUrl == '')
echo "${skipIntegTests ? 'Skipping integration tests as one of the values has empty string: INTEG_TEST_JOB_NAME, TEST_MANIFEST, buildManifestUrl' : 'Running integration tests'}"
if (!skipIntegTests) {
def integTestResults =
build job: INTEG_TEST_JOB_NAME,
propagate: false,
wait: false,
parameters: [
string(name: 'TEST_MANIFEST', value: TEST_MANIFEST),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true)
]
}
},
triggerIntegrationTests(buildManifestUrl)
'bwc-test': {
Boolean skipBwcTests = (BWC_TEST_JOB_NAME == '' || TEST_MANIFEST == '' || buildManifestUrl == '')
echo "${skipBwcTests ? 'Skipping BWC tests as one of the values has empty string: BWC_TEST_JOB_NAME, TEST_MANIFEST, buildManifestUrl' : 'Running BWC tests'}"
Expand Down Expand Up @@ -284,7 +270,7 @@ pipeline {
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
postCleanup()
postCleanup()
}
}
}
Expand Down Expand Up @@ -318,16 +304,10 @@ pipeline {
echo "artifactUrl (linux, x64, rpm): ${artifactUrl}"

String bundleManifestUrl = buildManifestObj.getBundleManifestUrl(JOB_NAME, BUILD_NUMBER)

echo "Trigger rpm validation for linux x64 rpm ${bundleManifestUrl}"
def rpmValidationResults =
build job: 'rpm-validation',
propagate: false,
wait: false,
parameters: [
string(name: 'BUNDLE_MANIFEST_URL', value: bundleManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_LINUX_X64)
]
parallel([
triggerIntegrationTests(buildManifestUrl)
triggerRpmValidation(bundleManifestUrl)
])
}
}
post {
Expand Down Expand Up @@ -434,6 +414,7 @@ pipeline {
echo "artifactUrl (linux, x64, deb): ${artifactUrl}"

String bundleManifestUrl = buildManifestObj.getBundleManifestUrl(JOB_NAME, BUILD_NUMBER)
triggerIntegrationTests(buildManifestUrl)
}
}
post {
Expand Down Expand Up @@ -502,24 +483,7 @@ pipeline {

echo "buildManifestUrl (linux, arm64, tar): ${buildManifestUrl}"
echo "artifactUrl (linux, arm64, tar): ${artifactUrl}"

parallel([
'integ-test': {
Boolean skipIntegTests = (INTEG_TEST_JOB_NAME == '' || TEST_MANIFEST == '' || buildManifestUrl == '')
echo "${skipIntegTests ? 'Skipping integration tests as one of the values has empty string: INTEG_TEST_JOB_NAME, TEST_MANIFEST, buildManifestUrl' : 'Running integration tests'}"
if (!skipIntegTests) {
def integTestResults =
build job: INTEG_TEST_JOB_NAME,
propagate: false,
wait: false,
parameters: [
string(name: 'TEST_MANIFEST', value: TEST_MANIFEST),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true)
]
}
}
])
triggerIntegrationTests(buildManifestUrl)
}
}
post {
Expand Down Expand Up @@ -627,16 +591,10 @@ pipeline {
echo "artifactUrl (linux, arm64, rpm): ${artifactUrl}"

String bundleManifestUrl = buildManifestObj.getBundleManifestUrl(JOB_NAME, BUILD_NUMBER)

echo "Trigger rpm validation for linux arm64 rpm ${bundleManifestUrl}"
def rpmValidationResults =
build job: 'rpm-validation',
propagate: false,
wait: false,
parameters: [
string(name: 'BUNDLE_MANIFEST_URL', value: bundleManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_LINUX_ARM64)
]
parallel([
triggerIntegrationTests(buildManifestUrl)
triggerRpmValidation(bundleManifestUrl)
])
}
}
post {
Expand Down Expand Up @@ -743,8 +701,8 @@ pipeline {
echo "artifactUrl (linux, arm64, deb): ${artifactUrl}"

String bundleManifestUrl = buildManifestObj.getBundleManifestUrl(JOB_NAME, BUILD_NUMBER)
triggerIntegrationTests(buildManifestUrl)
}
}
post {
success {
script {
Expand Down Expand Up @@ -774,9 +732,9 @@ pipeline {
}
}
}
}
}
}
}
stage('build-and-test-windows-x64-zip') {
when {
beforeAgent true
Expand Down Expand Up @@ -811,8 +769,8 @@ pipeline {

echo "buildManifestUrl (windows, x64, zip): ${buildManifestUrl}"
echo "artifactUrl (windows, x64, zip): ${artifactUrl}"
triggerIntegrationTests(buildManifestUrl)
}
}
post {
success {
script {
Expand Down Expand Up @@ -845,9 +803,9 @@ pipeline {
}
}
}
}
}
}
}
}
stage('docker build') {
when {
beforeAgent true
Expand Down Expand Up @@ -884,7 +842,7 @@ pipeline {
}
}
}
}
}
post {
always {
node(AGENT_LINUX_X64) {
Expand Down Expand Up @@ -955,11 +913,39 @@ pipeline {
}
}
}
}
}

def markStageUnstableIfPluginsFailedToBuild() {
def stageLogs = getLogsForStage(stageName: "${STAGE_NAME}")
if (stageLogs.any{e -> e.contains('Failed plugins are')}) {
unstable('Some plugins failed to build. See the ./build.sh step for logs and more details')
}
}

def triggerIntegrationTests(String buildManifestUrl) {
Boolean skipIntegTests = (INTEG_TEST_JOB_NAME == '' || TEST_MANIFEST == '' || buildManifestUrl == '')
echo "${skipIntegTests ? 'Skipping integration tests as one of the values has empty string: INTEG_TEST_JOB_NAME, TEST_MANIFEST, buildManifestUrl' : 'Running integration tests'}"
if (!skipIntegTests) {
def integTestResults =
build job: INTEG_TEST_JOB_NAME,
propagate: false,
wait: false,
parameters: [
string(name: 'TEST_MANIFEST', value: TEST_MANIFEST),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
booleanParam(name: 'UPDATE_GITHUB_ISSUES', value: true)
]
}
}

def triggerRpmValidation(String bundleManifestUrl) {
echo "Triggering RPM validation for ${bundleManifestUrl}"
def rpmValidationResults =
build job: 'rpm-validation',
propagate: false,
wait: false,
parameters: [
string(name: 'BUNDLE_MANIFEST_URL', value: bundleManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_LINUX_X64)
]
}

0 comments on commit 5f10c2f

Please sign in to comment.