Skip to content

Commit

Permalink
Add test pipeline for pulling nested build info
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Jan 29, 2022
1 parent bf90820 commit 1f297e7
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 38 deletions.
104 changes: 66 additions & 38 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pipeline {
environment {
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host'
// TODO: change to integ-test when updated in Jenkins
INTEG_TEST_JOB_NAME = 'Playground/ohltyler-integ-test-stable'
}
parameters {
string(
Expand Down Expand Up @@ -119,15 +121,28 @@ pipeline {
echo "buildManifestUrl (x64): ${buildManifestUrl}"
echo "artifactUrl (x64): ${artifactUrl}"

IntegTestsX64: {
// TODO: change back to integ-test when updated in Jenkins
build job: 'Playground/ohltyler-integ-test-stable',
def integTestResults =
build job: INTEG_TEST_JOB_NAME,
propagate: false,
wait: true,
parameters: [
string(name: 'TEST_MANIFEST', value: "manifests/${TEST_MANIFEST}"),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_X64)
]
}

// Appending integ test results onto the existing output for this step
String integTestUrl = integTestResults.getAbsoluteUrl()
String integTestStatus = integTestResults.getResult()
echo "integTestUrl: ${integTestUrl}"
echo "integTestStatus: ${integTestStatus}"
lib.jenkins.Messages.new(this).add(
STAGE_NAME,
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + [
"\nInteg Test Job (x64): ${integTestUrl}",
"Integ Test Status (x64): ${integTestStatus}"
].join('\n')
)
}
}
post {
Expand Down Expand Up @@ -157,15 +172,28 @@ pipeline {
echo "buildManifestUrl (arm64): ${buildManifestUrl}"
echo "artifactUrl (arm64): ${artifactUrl}"

IntegTestsArm64: {
// TODO: change back to integ-test when updated in Jenkins
build job: 'Playground/ohltyler-integ-test-stable',
def integTestResults =
build job: INTEG_TEST_JOB_NAME,
propagate: false,
wait: true,
parameters: [
string(name: 'TEST_MANIFEST', value: "manifests/${TEST_MANIFEST}"),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_ARM64)
]
}

// Appending integ test results onto the existing output for this step
String integTestUrl = integTestResults.getAbsoluteUrl()
String integTestStatus = integTestResults.getResult()
echo "integTestUrl: ${integTestUrl}"
echo "integTestStatus: ${integTestStatus}"
lib.jenkins.Messages.new(this).add(
STAGE_NAME,
lib.jenkins.Messages.new(this).get([STAGE_NAME]) + [
"\nInteg Test Job (arm64): ${integTestUrl}",
"Integ Test Status (arm64): ${integTestStatus}"
].join('\n')
)
}
}
post {
Expand Down Expand Up @@ -194,37 +222,37 @@ pipeline {
}
}
}
// post {
// success {
// node('Jenkins-Agent-al2-x64-c54xlarge-Docker-Host') {
// script {
// def stashed = lib.jenkins.Messages.new(this).get(['build-x64', 'build-arm64'])
post {
success {
node(AGENT_X64) {
script {
def stashed = lib.jenkins.Messages.new(this).get(['build-and-test-x64', 'build-and-test-arm64'])

// publishNotification(
// icon: ':white_check_mark:',
// message: 'Successful Build',
// extra: stashed,
// credentialsId: 'BUILD_NOTICE_WEBHOOK',
// manifest: "${INPUT_MANIFEST}"
// )
publishNotification(
icon: ':white_check_mark:',
message: 'Successful Build',
extra: stashed,
credentialsId: 'BUILD_NOTICE_WEBHOOK',
manifest: "${INPUT_MANIFEST}"
)

// postCleanup()
// }
// }
// }
// failure {
// node('Jenkins-Agent-al2-x64-c54xlarge-Docker-Host') {
// script {
// publishNotification(
// icon: ':warning:',
// message: 'Failed Build',
// credentialsId: 'BUILD_NOTICE_WEBHOOK',
// manifest: "${INPUT_MANIFEST}"
// )
postCleanup()
}
}
}
failure {
node(AGENT_X64) {
script {
publishNotification(
icon: ':warning:',
message: 'Failed Build',
credentialsId: 'BUILD_NOTICE_WEBHOOK',
manifest: "${INPUT_MANIFEST}"
)

// postCleanup()
// }
// }
// }
// }
postCleanup()
}
}
}
}
}
65 changes: 65 additions & 0 deletions jenkins/opensearch/nested-integ-test.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm))

pipeline {
agent none
environment {
AGENT_X64 = 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
AGENT_ARM64 = 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host'
}
parameters {
string(
name: 'INPUT_MANIFEST',
description: 'Input manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0.yml.',
trim: true
)
}
stages {
stage('detect docker image + args') {
agent {
docker {
label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host'
image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028'
alwaysPull true
}
}
steps {
script {
dockerAgent = detectDockerAgent()
currentBuild.description = INPUT_MANIFEST
}
}
}
stage('build') {
agent {
docker {
label AGENT_X64
image dockerAgent.image
args dockerAgent.args
alwaysPull true
}
}
steps {
script {
String buildManifestUrl = 'https://ci.opensearch.org/ci/dbc/Playground/ohltyler-distribution-build-opensearch/1.2.2/27/linux/arm64/builds/opensearch/manifest.yml'
String testManifest = 'manifests/1.2.2/opensearch-1.2.2-test.yml'

echo "buildManifestUrl: ${buildManifestUrl}"
echo "testManifest: ${testManifest}"

def integTestX64 = build job: 'Playground/ohltyler-integ-test-stable',
propagate: false,
wait: true,
parameters: [
string(name: 'TEST_MANIFEST', value: "${testManifest}-broken"),
string(name: 'BUILD_MANIFEST_URL', value: buildManifestUrl),
string(name: 'AGENT_LABEL', value: AGENT_X64)
]
echo "integTextX64 class: ${integTestX64.getClass()}"
echo "integTestX64 number: ${integTestX64.getNumber()}"
echo "integTestX64 result: ${integTestX64.getResult()}"
echo "integTestX64 url: ${integTestX64.getAbsoluteUrl()}"
}
}
}
}
}

0 comments on commit 1f297e7

Please sign in to comment.