Skip to content

Commit

Permalink
Refactor and enable triggering integ-test for RPM, debian and windows (
Browse files Browse the repository at this point in the history
…#4368)

Signed-off-by: Sayali Gaikawad <[email protected]>
  • Loading branch information
gaiksaya authored Jan 24, 2024
1 parent fec0355 commit 685f23a
Showing 1 changed file with 53 additions and 55 deletions.
108 changes: 53 additions & 55 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,7 @@ pipeline {

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 == '')
Expand All @@ -210,7 +198,7 @@ pipeline {
]
}
}
])
])
}
}
post {
Expand Down Expand Up @@ -284,7 +272,7 @@ pipeline {
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
postCleanup()
postCleanup()
}
}
}
Expand Down Expand Up @@ -318,16 +306,14 @@ 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([
'integ-test': {
triggerIntegrationTests(buildManifestUrl)
},
'rpm-validation': {
triggerRpmValidation(bundleManifestUrl)
}
])
}
}
post {
Expand Down Expand Up @@ -400,7 +386,7 @@ pipeline {
if (params.CONTINUE_ON_ERROR) {
markStageUnstableIfPluginsFailedToBuild()
}
postCleanup()
postCleanup()
}
}
}
Expand Down Expand Up @@ -434,6 +420,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 +489,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 +597,14 @@ 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([
'integ-test': {
triggerIntegrationTests(buildManifestUrl)
},
'rpm-validation': {
triggerRpmValidation(bundleManifestUrl)
}
])
}
}
post {
Expand Down Expand Up @@ -743,6 +711,7 @@ pipeline {
echo "artifactUrl (linux, arm64, deb): ${artifactUrl}"

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

echo "buildManifestUrl (windows, x64, zip): ${buildManifestUrl}"
echo "artifactUrl (windows, x64, zip): ${artifactUrl}"
triggerIntegrationTests(buildManifestUrl)
}
}
post {
Expand Down Expand Up @@ -959,7 +929,35 @@ pipeline {

def markStageUnstableIfPluginsFailedToBuild() {
def stageLogs = getLogsForStage(stageName: "${STAGE_NAME}")
if (stageLogs.any{e -> e.contains('Failed plugins are')}) {
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 685f23a

Please sign in to comment.