/* * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. */ pipeline { agent none options { copyArtifactPermission('bundle-build-*') buildDiscarder(logRotator(artifactNumToKeepStr: '1')) } parameters { string( name: 'INPUT_MANIFEST', defaultValue: '1.3.0/opensearch-dashboards-1.3.0.yml', description: 'Input manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-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 { currentBuild.description = "$INPUT_MANIFEST" dockerAgent = detectDockerAgent() } } } stage('build') { parallel { stage('build-linux-x64') { agent { docker { label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' image dockerAgent.image args dockerAgent.args alwaysPull true } } steps { script { def buildManifestObj = archiveAssembleUpload( inputManifest: "manifests/${INPUT_MANIFEST}", platform: 'linux', architecture: 'x64', stashName: 'test-stash-tar-x64' ) String artifactUrl = buildManifestObj.getArtifactUrl('bundle-build', '1') env.ARTIFACT_URL_X64 = artifactUrl echo "artifactUrl (x64): ${artifactUrl}" } } post { always { postCleanup() } } } stage('build-linux-arm64') { agent none stages { stage('build-archive-linux-arm64') { agent { docker { label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' image dockerAgent.image args dockerAgent.args alwaysPull true } } steps { script { buildArchive( inputManifest: "manifests/${INPUT_MANIFEST}", platform: 'linux', architecture: 'arm64', stashName: 'test-stash-tar-arm64' ) } } post { always { postCleanup() } } } stage('assemble-archive-linux-arm64') { agent { docker { label 'Jenkins-Agent-AL2-Arm64-C6g4xlarge-Docker-Host' image dockerAgent.image args dockerAgent.args alwaysPull true } } steps { script { def buildManifestObj = archiveAssembleUpload( inputManifest: "manifests/${INPUT_MANIFEST}", platform: 'linux', architecture: 'arm64' stashName: 'test-stash-tar-arm64' ) String artifactUrl = buildManifestObj.getArtifactUrl('bundle-build', '1') env.ARTIFACT_URL_ARM64 = artifactUrl echo "artifactUrl (arm64): ${artifactUrl}" } } post { always { postCleanup() } } } } } } } stage('docker build') { steps { node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') { script { buildDockerImage( inputManifest: "manifests/${INPUT_MANIFEST}", artifactUrlX64: env.ARTIFACT_URL_X64, artifactUrlArm64: env.ARTIFACT_URL_ARM64 ) } } } } } post { success { node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') { script { def stashed = lib.jenkins.Messages.new(this).get([ 'build-linux-x64', 'build-archive-linux-arm64', 'assemble-archive-linux-arm64' ]) echo "SUCCESS: ${stashed}" postCleanup() } } } failure { node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') { script { echo 'FAILURE' postCleanup() } } } } }