From 21ddb534f5082ec7596a0e15aea564a250afebb4 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Wed, 11 Jan 2023 10:54:34 -0800 Subject: [PATCH 1/6] Add release workflows Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000000..b8946d00c1 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,28 @@ +name: Release drafter + +on: + push: + tags: + - "*" + +jobs: + draft-a-release: + name: Draft a release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: 11 + - name: Build with Gradle + run: | + ./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository && tar -C build -cvf artifacts.tar.gz repository + - name: Draft a release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true + files: | + artifacts.tar.gz \ No newline at end of file From 3fd734e8fda2f8b76fc136c6c884379758711158 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Wed, 11 Jan 2023 11:37:08 -0800 Subject: [PATCH 2/6] Fix java Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index b8946d00c1..00c50d4159 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -13,7 +13,7 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v1 with: java-version: 11 - name: Build with Gradle From e73724d2ba096ca1936313d59bf3a308109ac589 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Wed, 11 Jan 2023 11:43:41 -0800 Subject: [PATCH 3/6] Add new release jenkinsFile Signed-off-by: Sayali Gaikawad --- .github/workflows/release-drafter.yml | 2 +- jenkins/release.jenkinsFile | 16 +++++ jenkins/stage-maven-release.jenkinsfile | 90 ------------------------- 3 files changed, 17 insertions(+), 91 deletions(-) create mode 100644 jenkins/release.jenkinsFile delete mode 100644 jenkins/stage-maven-release.jenkinsfile diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 00c50d4159..e3f52436b7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -25,4 +25,4 @@ jobs: draft: true generate_release_notes: true files: | - artifacts.tar.gz \ No newline at end of file + artifacts.tar.gz diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile new file mode 100644 index 0000000000..d8289b3866 --- /dev/null +++ b/jenkins/release.jenkinsFile @@ -0,0 +1,16 @@ +lib = library(identifier: 'jenkins@1.5.3', retriever: modernSCM([ + $class: 'GitSCMSource', + remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', +])) + +standardReleasePipelineWithGenericTrigger( + tokenIdCredential: 'jenkins-opensearch-java-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/opensearch-java repository causing this workflow to run', + downloadReleaseAsset: true, + publishRelease: true) { + publishToMaven( + signingArtifactsPath: "$WORKSPACE/repository/", + mavenArtifactsPath: "$WORKSPACE/repository/", + autoPublish: true + ) + } diff --git a/jenkins/stage-maven-release.jenkinsfile b/jenkins/stage-maven-release.jenkinsfile deleted file mode 100644 index 80969ce215..0000000000 --- a/jenkins/stage-maven-release.jenkinsfile +++ /dev/null @@ -1,90 +0,0 @@ -lib = library(identifier: 'jenkins@main', retriever: modernSCM([ - $class: 'GitSCMSource', - remote: 'https://github.com/opensearch-project/opensearch-build.git', -])) - -pipeline { - options { - timeout(time: 30, unit: 'MINUTES') - throttleJobProperty( - categories: [], - limitOneJobWithMatchingParams: false, - maxConcurrentPerNode: 0, - maxConcurrentTotal: 1, - paramsToUseForLimit: '', - throttleEnabled: true, - throttleOption: 'project', - ) - } - agent { - docker { - label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' - image 'opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2' - args '-e JAVA_HOME=/opt/java/openjdk-11' - alwaysPull true - } - } - triggers { - GenericTrigger( - genericVariables: [ - [key: 'ref', value: '$.ref'], - [key: 'VERSION', value: '$.ref', regexpFilter: 'refs/tags/v' ], - ], - tokenCredentialId: 'jenkins-opensearch-java-generic-webhook-token', - causeString: 'A tag was cut on opensearch-project/opensearch-java repository causing this workflow to run', - printContributedVariables: false, - printPostContent: false, - regexpFilterText: '$ref', - regexpFilterExpression: '^refs/tags/.*' - ) - } - environment { - ARTIFACT_PATH = "$WORKSPACE/build/repository/org/opensearch/client/opensearch-java/$VERSION" - } - stages { - stage('Publish to Maven Local') { - steps { - // checkout the commit - checkout([ - $class: 'GitSCM', userRemoteConfigs: [[url: 'https://github.com/opensearch-project/opensearch-java.git']], - branches: [[name: "$ref"]] - ]) - - // publish maven artifacts - sh('./gradlew --no-daemon publishPublishMavenPublicationToLocalRepoRepository') - } - } - stage('Sign') { - steps { - script { - signArtifacts( - artifactPath: "${ARTIFACT_PATH}", - type: 'maven', - platform: 'linux' - ) - } - } - } - stage('Stage Maven Artifacts') { - environment { - REPO_URL = 'https://aws.oss.sonatype.org/' - STAGING_PROFILE_ID = "${SONATYPE_STAGING_PROFILE_ID}" - BUILD_ID = "${BUILD_NUMBER}" - } - steps { - // checkout the build repo - git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main' - - // stage artifacts for release with Sonatype - withCredentials([usernamePassword(credentialsId: 'jenkins-sonatype-creds', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD')]) { - sh('$WORKSPACE/publish/stage-maven-release.sh $WORKSPACE/build/repository/') - } - } - } - } - post { - always { - cleanWs disableDeferredWipeout: true, deleteDirs: true - } - } -} From 0870ecef42bf252147e60f0cffcaf82c7de798c5 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Wed, 11 Jan 2023 11:54:36 -0800 Subject: [PATCH 4/6] Modify releasing.md Signed-off-by: Sayali Gaikawad --- RELEASING.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 14dac4c92e..0d0729e578 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -34,9 +34,5 @@ Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md). 1. Create a tag, e.g. `v2.1.0`, and push it to the GitHub repo. -2. The [opensearch-java-maven-sign-and-release/](https://build.ci.opensearch.org/job/opensearch-java-maven-sign-and-release/) will be automatically kicked off. -3. Login to [AWS OSS Sonatype](https://aws.oss.sonatype.org/#stagingRepositories), and locate the staged release. -4. `Close` the staged repository, and ensure all checks pass. -5. `Release` the staged respository. -6. [Create a release on GitHub](https://github.com/opensearch-project/opensearch-java/releases/new) with release notes. -7. Increment `systemProp.version` in [gradle.properties](gradle.properties) to the next patch release, e.g. `v2.1.1`, commit and push. \ No newline at end of file +2. This creates a draft release which triggers the [opensearch-java-maven-sign-and-release/](https://build.ci.opensearch.org/job/opensearch-java-maven-sign-and-release/) jenkins workflow. The artifacts will be automcatically signed and published to maven. +3. Increment `systemProp.version` in [gradle.properties](gradle.properties) to the next patch release, e.g. `v2.1.1`, commit and push. \ No newline at end of file From e424c39697768e13bcafdf7d0eee06aca8567e62 Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Wed, 11 Jan 2023 12:00:15 -0800 Subject: [PATCH 5/6] Changelog Signed-off-by: Sayali Gaikawad --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e7abc4de..2d10bbeaf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Github workflow for changelog verification ([#239](https://github.com/opensearch-project/opensearch-java/pull/239)) - Github workflow for dependabot PRs ([#247](https://github.com/opensearch-project/opensearch-java/pull/247)) - Add javadoc link for the client ([#255](https://github.com/opensearch-project/opensearch-java/pull/255)) +- Add new release workflows ([#321](https://github.com/opensearch-project/opensearch-java/pull/321)) ### Dependencies - Bumps `classgraph` from 4.8.149 to 4.8.154 From 6726219627db3631fb9b98c0da496c75dca1760f Mon Sep 17 00:00:00 2001 From: Sayali Gaikawad Date: Thu, 12 Jan 2023 13:56:29 -0800 Subject: [PATCH 6/6] Fix changelog Signed-off-by: Sayali Gaikawad --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d10bbeaf6..6238750fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Github workflow for changelog verification ([#239](https://github.com/opensearch-project/opensearch-java/pull/239)) - Github workflow for dependabot PRs ([#247](https://github.com/opensearch-project/opensearch-java/pull/247)) - Add javadoc link for the client ([#255](https://github.com/opensearch-project/opensearch-java/pull/255)) -- Add new release workflows ([#321](https://github.com/opensearch-project/opensearch-java/pull/321)) +- Add 1-click release workflows ([#321](https://github.com/opensearch-project/opensearch-java/pull/321)) ### Dependencies - Bumps `classgraph` from 4.8.149 to 4.8.154