Skip to content

Commit

Permalink
Update Jenkinsfile to build arm64 and x64 in parallel (#304)
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Handalian <[email protected]>
  • Loading branch information
mch2 authored Aug 24, 2021
1 parent 147cee8 commit b3b7058
Showing 1 changed file with 44 additions and 21 deletions.
65 changes: 44 additions & 21 deletions bundle-workflow/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pipeline {
agent {
node {
label 'Jenkins-Agent-al2-x64-m5xlarge'
}
}
agent none
environment {
OPENSEARCH_BUILD_ID = "${BUILD_NUMBER}"
}
tools {
jdk "JDK14"
maven "maven-3.8.2"
}
stages {
stage('parameters') {
steps {
Expand All @@ -23,23 +23,46 @@ pipeline {
}
}
}
stage('build-x64') {
tools {
jdk "JDK14"
maven "maven-3.8.2"
}
steps {
git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main'
sh "./bundle-workflow/build.sh manifests/$BUILD_MANIFEST"
sh './bundle-workflow/assemble.sh artifacts/manifest.yml'

script { manifest = readYaml(file: 'artifacts/manifest.yml') }

withAWS(role: 'opensearch-bundle', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
s3Upload(file: 'artifacts', bucket: "${ARTIFACT_BUCKET_NAME}", path: "builds/${manifest.build.version}/${manifest.build.architecture}/${OPENSEARCH_BUILD_ID}")
s3Upload(file: "bundle", bucket: "${ARTIFACT_BUCKET_NAME}", path: "bundles/${manifest.build.version}/${manifest.build.architecture}/${OPENSEARCH_BUILD_ID}")
stage('build') {
parallel {
stage('build-x86') {
agent {
node {
label 'Jenkins-Agent-al2-x64-m5xlarge'
}
}
steps {
script {
build()
}
}
}
stage('build-arm64') {
agent {
node {
label 'Jenkins-Agent-al2-arm64-m6gxlarge'
}
}
steps {
script {
build()
}
}
}
}
}
}
}
}

void build() {
git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main'
sh "./bundle-workflow/build.sh manifests/$BUILD_MANIFEST"
sh './bundle-workflow/assemble.sh artifacts/manifest.yml'

script { manifest = readYaml(file: 'artifacts/manifest.yml') }

withAWS(role: 'opensearch-bundle', roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') {
s3Upload(file: 'artifacts', bucket: "${ARTIFACT_BUCKET_NAME}", path: "builds/${manifest.build.version}/${OPENSEARCH_BUILD_ID}/${manifest.build.architecture}")
s3Upload(file: "bundle", bucket: "${ARTIFACT_BUCKET_NAME}", path: "bundles/${manifest.build.version}/${OPENSEARCH_BUILD_ID}/${manifest.build.architecture}")
}
}

0 comments on commit b3b7058

Please sign in to comment.