From 142b70281e8c117834b7a81d811ba0234a61ca3a Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Tue, 19 Dec 2023 20:00:46 -0800 Subject: [PATCH] Releation promition workflow Signed-off-by: Prudhvi Godithi --- .../promotion/release-promotion.jenkinsfile | 433 ++++++++++++++++++ 1 file changed, 433 insertions(+) create mode 100644 jenkins/promotion/release-promotion.jenkinsfile diff --git a/jenkins/promotion/release-promotion.jenkinsfile b/jenkins/promotion/release-promotion.jenkinsfile new file mode 100644 index 0000000000..e1de0d5093 --- /dev/null +++ b/jenkins/promotion/release-promotion.jenkinsfile @@ -0,0 +1,433 @@ +/* + * 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. + */ + +lib = library(identifier: 'jenkins@5.11.1', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +pipeline { + options { + timeout(time: 4, unit: 'HOURS') + } + agent none + environment { + AGENT_LINUX_X64 = 'Jenkins-Agent-AL2023-X64-C54xlarge-Docker-Host' + } + parameters { + string( + name: 'RELEASE_VERSION', + description: 'Release version', + trim: true + ) + string( + name: 'OPENSEARCH_RC', + description: 'OpenSearch Release Candidate', + trim: true + ) + string( + name: 'OPENSEARCH_DASHBOARDS_RC', + description: 'OpenSearch Dashboards Release Candidate', + trim: true + ) + } + stages { + stage('Parameters Check') { + steps { + script { + currentBuild.description = """RELEASE: ${RELEASE_VERSION}
OS_RC: ${OPENSEARCH_RC}
OSD_RC: ${OPENSEARCH_DASHBOARDS_RC}""" + if(RELEASE_VERSION.isEmpty() || OPENSEARCH_RC.isEmpty() || OPENSEARCH_DASHBOARDS_RC.isEmpty()) { + currentBuild.result = 'ABORTED' + error('Make sure all the parameters are passed in.') + } + } + } + } + stage('OpenSearch Apt promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-repos for OpenSearch apt' + build job: 'distribution-promote-repos', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_REPO_TYPE', value: 'apt'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-build-opensearch completed!' + } + } + stage('OpenSearch Yum promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-repos for OpenSearch yum' + build job: 'distribution-promote-repos', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_REPO_TYPE', value: 'yum'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-repos for OpenSearch yum completed!' + } + } + stage('OpenSearch Dashboards Apt promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-repos for OpenSearch Dashboards apt' + build job: 'distribution-promote-repos', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_REPO_TYPE', value: 'apt'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-repos for OpenSearch Dashboards completed!' + } + } + stage('OpenSearch Dashboards Yum promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-repos for OpenSearch Dashboards yum' + build job: 'distribution-promote-repos', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_REPO_TYPE', value: 'yum'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-repos for OpenSearch Dashboards yum completed!' + } + } + stage('OpenSearch Windows promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for opensearch windows' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'windows'), + choice(name: 'DISTRIBUTION_NAME', value: 'zip'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for opensearch windows completed!' + } + } + stage('OpenSearch Dashboards Windows promotion') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for opensearch windows' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'windows'), + choice(name: 'DISTRIBUTION_NAME', value: 'zip'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for opensearch windows completed!' + } + } + stage('OpenSearch Linux deb arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux deb arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'deb'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux deb arm64 completed!' + } + } + stage('OpenSearch Linux deb x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux deb x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'deb'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux deb x64 completed!' + } + } + stage('OpenSearch Dashboards Linux deb arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux deb arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'deb'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux deb arm64 completed!' + } + } + stage('OpenSearch Dashboards Linux deb x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux deb x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'deb'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux deb x64 completed!' + } + } + stage('OpenSearch Linux rpm arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux rpm arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'rpm'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux rpm arm64 completed!' + } + } + stage('OpenSearch Linux rpm x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux rpm x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'rpm'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux rpm x64 completed!' + } + } + stage('OpenSearch Dashboards Linux rpm arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux rpm arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'rpm'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux rpm arm64 completed!' + } + } + stage('OpenSearch Dashboards Linux rpm x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux rpm x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'rpm'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux rpm x64 completed!' + } + } + stage('OpenSearch Linux tar arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux tar arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'tar'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux tar arm64 completed!' + } + } + stage('OpenSearch Linux tar x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Linux tar x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'tar'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Linux rpm x64 completed!' + } + } + stage('OpenSearch Dashboards Linux tar arm64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux tar arm64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'tar'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'arm64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux tar arm64 completed!' + } + } + stage('OpenSearch Dashboards Linux tar x64') { + agent { + docker { + label AGENT_LINUX_X64 + image 'docker/library/alpine:3' + registryUrl 'https://public.ecr.aws/' + alwaysPull true + } + } + steps { + echo 'Triggering distribution-promote-artifacts for OpenSearch Dashboards Linux tar x64' + build job: 'distribution-promote-artifacts', wait: true, parameters: [choice(name: 'DISTRIBUTION_JOB_NAME', value: 'distribution-build-opensearch-dashboards'), + choice(name: 'DISTRIBUTION_PLATFORM', value: 'linux'), + choice(name: 'DISTRIBUTION_NAME', value: 'tar'), + choice(name: 'DISTRIBUTION_ARCHITECTURE', value: 'x64'), + string(name: 'DISTRIBUTION_BUILD_NUMBER', value: params.OPENSEARCH_DASHBOARDS_RC), + string(name: 'INPUT_MANIFEST', value: '${params.RELEASE_VERSION}/opensearch-dashboards-${params.RELEASE_VERSION}.yml'), + ] + echo 'Job distribution-promote-artifacts for OpenSearch Dashboards Linux tar x64 completed!' + } + } + } + post { + always { + node(AGENT_LINUX_X64) { + checkout scm + script { + postCleanup() + } + } + } + } +}