Skip to content

Commit

Permalink
Refactor distribution build job (#5192)
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <[email protected]>
  • Loading branch information
rishabh6788 authored Nov 21, 2024
1 parent 7d2ae0b commit 0931ccc
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 69 deletions.
79 changes: 45 additions & 34 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -872,44 +872,55 @@ pipeline {
}
}
}
}
}
stage('docker build') {
when {
beforeAgent true
allOf {
expression {
params.BUILD_DOCKER != 'do_not_build_docker'
stage('docker build') {
when {
beforeAgent true
allOf {
expression {
params.BUILD_DOCKER != 'do_not_build_docker'
}
expression {
params.BUILD_PLATFORM.contains('linux')
}
expression {
params.BUILD_DISTRIBUTION.contains('tar')
}
}
}
expression {
params.BUILD_PLATFORM.contains('linux')
options {
timeout(time: 90, unit: 'MINUTES')
}
expression {
params.BUILD_DISTRIBUTION.contains('tar')
agent {
docker {
label AGENT_LINUX_X64
image dockerAgent.image
args dockerAgent.args
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
}
}
agent {
docker {
label AGENT_LINUX_X64
image dockerAgent.image
args dockerAgent.args
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
steps {
script {
echo "env.ARTIFACT_URL_LINUX_X64_TAR: ${env.ARTIFACT_URL_LINUX_X64_TAR}"
echo "env.ARTIFACT_URL_LINUX_ARM64_TAR: ${env.ARTIFACT_URL_LINUX_ARM64_TAR}"
steps {
script {
while(true) {
if (env.ARTIFACT_URL_LINUX_X64_TAR != null && env.ARTIFACT_URL_LINUX_ARM64_TAR != null) {
echo "env.ARTIFACT_URL_LINUX_X64_TAR: ${env.ARTIFACT_URL_LINUX_X64_TAR}"
echo "env.ARTIFACT_URL_LINUX_ARM64_TAR: ${env.ARTIFACT_URL_LINUX_ARM64_TAR}"

buildDockerImage(
inputManifest: "manifests/${INPUT_MANIFEST}",
buildNumber: "${BUILD_NUMBER}",
buildOption: "${BUILD_DOCKER}",
artifactUrlX64: env.ARTIFACT_URL_LINUX_X64_TAR,
artifactUrlArm64: env.ARTIFACT_URL_LINUX_ARM64_TAR
)
buildDockerImage(
inputManifest: "manifests/${INPUT_MANIFEST}",
buildNumber: "${BUILD_NUMBER}",
buildOption: "${BUILD_DOCKER}",
artifactUrlX64: env.ARTIFACT_URL_LINUX_X64_TAR,
artifactUrlArm64: env.ARTIFACT_URL_LINUX_ARM64_TAR
)
break
} else {
echo "Waiting for x64 and arm64 tar builds to complete, sleeping 120 seconds..."
sleep(time: 120, unit: 'SECONDS')
}
}
}
}
}
}
}
Expand Down
82 changes: 47 additions & 35 deletions jenkins/opensearch/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ pipeline {
expression {
params.BUILD_DISTRIBUTION.contains('deb')
}

}
agent { label AGENT_LINUX_ARM64 }
stages {
Expand Down Expand Up @@ -834,41 +834,53 @@ pipeline {
}
}
}
}
}
stage('docker build') {
when {
beforeAgent true
allOf {
expression {
params.BUILD_DOCKER != 'do_not_build_docker'
stage('docker build') {
when {
beforeAgent true
allOf {
expression {
params.BUILD_DOCKER != 'do_not_build_docker'
}
expression {
params.BUILD_PLATFORM.contains('linux')
}
}
}
expression {
params.BUILD_PLATFORM.contains('linux')
options {
timeout(time: 90, unit: 'MINUTES')
}
agent {
docker {
label AGENT_LINUX_X64
image dockerAgent.image
args dockerAgent.args
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
steps {
script {
while (true){
if (env.ARTIFACT_URL_LINUX_X64_TAR != null && env.ARTIFACT_URL_LINUX_ARM64_TAR != null) {
echo "env.ARTIFACT_URL_LINUX_X64_TAR: ${env.ARTIFACT_URL_LINUX_X64_TAR}"
echo "env.ARTIFACT_URL_LINUX_ARM64_TAR: ${env.ARTIFACT_URL_LINUX_ARM64_TAR}"
buildDockerImage(
inputManifest: "manifests/${INPUT_MANIFEST}",
buildNumber: "${BUILD_NUMBER}",
buildOption: "${BUILD_DOCKER}",
artifactUrlX64: env.ARTIFACT_URL_LINUX_X64_TAR,
artifactUrlArm64: env.ARTIFACT_URL_LINUX_ARM64_TAR
)
break
} else {
echo "Waiting for x64 and arm64 tar builds to complete, sleeping 120 seconds..."
sleep(time: 120, unit: 'SECONDS')

}
}

}
}
}
}
agent {
docker {
label AGENT_LINUX_X64
image dockerAgent.image
args dockerAgent.args
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
steps {
script {
echo "env.ARTIFACT_URL_LINUX_X64_TAR: ${env.ARTIFACT_URL_X64_TAR}"
echo "env.ARTIFACT_URL_LINUX_ARM64_TAR: ${env.ARTIFACT_URL_ARM64_TAR}"

buildDockerImage(
inputManifest: "manifests/${INPUT_MANIFEST}",
buildNumber: "${BUILD_NUMBER}",
buildOption: "${BUILD_DOCKER}",
artifactUrlX64: env.ARTIFACT_URL_LINUX_X64_TAR,
artifactUrlArm64: env.ARTIFACT_URL_LINUX_ARM64_TAR
)
}
}
}
Expand Down Expand Up @@ -896,7 +908,7 @@ pipeline {
}
postCleanup()
}

}
}
success {
Expand Down

0 comments on commit 0931ccc

Please sign in to comment.