From 5be84e1d37bf0713f092131fe11317044ee5a77c Mon Sep 17 00:00:00 2001 From: Rishabh Singh Date: Mon, 12 Dec 2022 13:14:47 -0800 Subject: [PATCH] Added jenkinsfile job to auto-release maven artifacts (#2991) Signed-off-by: Rishabh Singh Signed-off-by: Rishabh Singh --- .../maven-sign-release.jenkinsfile | 4 +- .../publish-to-maven.jenkinsfile | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 jenkins/opensearch-maven-release/publish-to-maven.jenkinsfile diff --git a/jenkins/opensearch-maven-release/maven-sign-release.jenkinsfile b/jenkins/opensearch-maven-release/maven-sign-release.jenkinsfile index 061561fc01..0d0e620cd3 100644 --- a/jenkins/opensearch-maven-release/maven-sign-release.jenkinsfile +++ b/jenkins/opensearch-maven-release/maven-sign-release.jenkinsfile @@ -14,12 +14,12 @@ pipeline { parameters { string( name: 'BUILD_ID', - description: 'Build ID of the OpenSearch distribution artifacts to be staged.', + description: 'Build ID of the OpenSearch distribution artifacts to be staged and released', trim: true ) string( name: 'VERSION', - description: 'Version of the OpenSearch distribution artifacts to be staged.', + description: 'Version of the OpenSearch distribution artifacts to be staged and released', trim: true ) } diff --git a/jenkins/opensearch-maven-release/publish-to-maven.jenkinsfile b/jenkins/opensearch-maven-release/publish-to-maven.jenkinsfile new file mode 100644 index 0000000000..a48da7a3de --- /dev/null +++ b/jenkins/opensearch-maven-release/publish-to-maven.jenkinsfile @@ -0,0 +1,61 @@ +lib = library(identifier: 'jenkins@1.5.0', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +pipeline { + agent { + docker { + label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' + image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211130' + alwaysPull true + } + } + parameters { + string( + name: 'BUILD_ID', + description: 'Build ID of the OpenSearch distribution artifacts to be staged.', + trim: true + ) + string( + name: 'VERSION', + description: 'Version of the OpenSearch distribution artifacts to be staged.', + trim: true + ) + } + environment { + ARTIFACT_PATH = "distribution-build-opensearch/${VERSION}/${BUILD_ID}/linux/x64/tar/builds" + ARTIFACT_BUCKET_NAME = credentials('jenkins-artifact-bucket-name') + REPO_URL = "https://aws.oss.sonatype.org/" + STAGING_PROFILE_ID = "${SONATYPE_STAGING_PROFILE_ID}" + BUILD_ID = "${BUILD_ID}" + } + stages { + stage('sign-stage-and-release') { + steps { + script { + echo "Downloading from S3." + downloadFromS3( + destPath: "$WORKSPACE/artifacts", + bucket: "${ARTIFACT_BUCKET_NAME}", + path: "${ARTIFACT_PATH}/", + force: true + ) + echo "Signing, Staging and Publishing Maven artifacts." + publishToMaven( + signingArtifactsPath: "$WORKSPACE/artifacts/$ARTIFACT_PATH/opensearch/manifest.yml", + mavenArtifactsPath: "$WORKSPACE/artifacts/$ARTIFACT_PATH/opensearch/maven", + autoPublish: true + ) + } + } + } + } + post() { + always { + script { + postCleanup() + } + } + } +}