From a61b95b11f8004f684a58fe6f11297ec319775ef Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 19 Jun 2023 18:09:12 -0700 Subject: [PATCH 1/9] Add release drafter and jenkins workflows. Signed-off-by: Yury-Fridlyand --- .github/workflows/release-drafter.yml | 30 +++++++++++++++++++ jenkins/release.jenkinsFile | 16 ++++++++++ ...l-odbc.OpenSearch.release-notes-1.5.0.0.md | 2 ++ 3 files changed, 48 insertions(+) create mode 100644 .github/workflows/release-drafter.yml create mode 100644 jenkins/release.jenkinsFile diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..c508400 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,30 @@ +name: Release drafter + +# Push events to every tag not containing "/" +on: + push: + tags: + - "*" + +jobs: + draft-a-release: + name: Draft a release + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: dawidd6/action-download-artifact@v2.27.0 + with: + workflow: sql-odbc-main.yml + branch: main + workflow_conclusion: success + skip_unpack: true + + - name: Draft a release + uses: softprops/action-gh-release@v1 + with: + draft: true + generate_release_notes: true + files: | + mac64-build.zip + windows32-installer.zip + windows64-installer.zip diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile new file mode 100644 index 0000000..fc8d434 --- /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-sql-odbc-generic-webhook-token', + causeString: 'A tag was cut on opensearch-project/sql-odbc repository causing this workflow to run', + downloadReleaseAsset: true, + publishRelease: true) { + publishToMaven( + signingArtifactsPath: "$WORKSPACE/repository/", + mavenArtifactsPath: "$WORKSPACE/repository/", + autoPublish: true + ) + } diff --git a/release-notes/sql-odbc.OpenSearch.release-notes-1.5.0.0.md b/release-notes/sql-odbc.OpenSearch.release-notes-1.5.0.0.md index 6f61351..e92c4e4 100644 --- a/release-notes/sql-odbc.OpenSearch.release-notes-1.5.0.0.md +++ b/release-notes/sql-odbc.OpenSearch.release-notes-1.5.0.0.md @@ -41,3 +41,5 @@ * Bump version and update vendor. ([#47](https://github.com/opensearch-project/sql-odbc/pull/47)) * Add release notes for version 1.5. ([#49](https://github.com/opensearch-project/sql-odbc/pull/49)) * Update `.gitignore`. ([#50](https://github.com/opensearch-project/sql-odbc/pull/50)) +* Update maintainer list. ([#51](https://github.com/opensearch-project/sql-odbc/pull/51)) +* Onboard 1 click release process. ([#52](https://github.com/opensearch-project/sql-odbc/pull/52) From 5b1b6695c9ea3f402d71c9166e4794732ee27511 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 19 Jun 2023 19:22:42 -0700 Subject: [PATCH 2/9] Add RELEASING. Signed-off-by: Yury-Fridlyand --- RELEASING.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 RELEASING.md diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..8ee6cce --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,40 @@ +- [Overview](#overview) +- [Branching](#branching) + - [Release Branching](#release-branching) + - [Feature Branches](#feature-branches) +- [Release Labels](#release-labels) +- [Releasing](#releasing) + +## Overview + +This document explains the release strategy for artifacts in this organization. + +## Branching + +### Release Branching + +Given the current major release of 1.0, projects in this organization maintain the following active branches. + +* **main**: The next _major_ release. This is the branch where all merges take place and code moves fast. +* **1.x**: The next _minor_ release. Once a change is merged into `main`, decide whether to backport it to `1.x`. +* **1.0**: The _current_ release. In between minor releases, only hotfixes (e.g. security) are backported to `1.0`. + +Label PRs with the next major version label (e.g. `v2.0.0.0`) and merge changes into `main`. Label PRs that you believe need to be backported as `backport 1.x` and `backport 1.0`. Backport PRs by checking out the versioned branch, cherry-pick changes and open a PR against each target backport branch. + +### Feature Branches + +Do not create branches in the upstream repo, use your fork, for the exception of long lasting feature branches that require active collaboration from multiple developers. Name feature branches `feature/`. Once the work is merged to `main`, please make sure to delete the feature branch. + +## Release Labels + +Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v2.0.0`, as well as `patch` and `backport`. Use release labels to target an issue or a PR for a given release. + +## Releasing + +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. 1.0.0.0, and push it to this GitHub repository. +2. The [release-drafter.yml](.github/workflows/release-drafter.yml) will be automatically kicked off and a draft release will be created. +3. This draft release triggers the [jenkins release workflow](https://build.ci.opensearch.org/job/sql-odbc-release) as a result of which the driver is released and published on artifacts (https://artifacts.opensearch.org/opensearch-clients/odbc/). Please note, that the release workflow is triggered only if created release is in draft state. Manual update on the [download page](https://opensearch.org/downloads.html#drivers) is required after that, see [website repo](https://github.com/opensearch-project/project-website/tree/main/_artifacts/opensearch-drivers). +4. Once the above release workflow is successful, the drafted release on GitHub is published automatically. +5. Increment `DRIVER_PACKAGE_VERSION` in [src/CMakeLists.txt](src/CMakeLists.txt) to the next iteration, e.g. 1.0.0.1 See [example](https://github.com/opensearch-project/sql-odbc/pull/47). From f1770357955687559f3a644aef3354f645d5232f Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Mon, 19 Jun 2023 19:27:15 -0700 Subject: [PATCH 3/9] Typo fix. Signed-off-by: Yury-Fridlyand --- .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 c508400..b08ad76 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -25,6 +25,6 @@ jobs: draft: true generate_release_notes: true files: | - mac64-build.zip + mac64-installer.zip windows32-installer.zip windows64-installer.zip From 6dec127ab91882535d447a7b98276124f7a63d8a Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 20 Jun 2023 10:16:01 -0700 Subject: [PATCH 4/9] Minor fix. Signed-off-by: Yury-Fridlyand --- .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 b08ad76..5e0753d 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -15,7 +15,7 @@ jobs: uses: dawidd6/action-download-artifact@v2.27.0 with: workflow: sql-odbc-main.yml - branch: main + commit: ${{github.sha}} workflow_conclusion: success skip_unpack: true From 52fa5a4f569d0e0cddac640493f76a7708bb34dd Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 20 Jun 2023 14:22:53 -0700 Subject: [PATCH 5/9] Pack artifacts into single archive. Signed-off-by: Yury-Fridlyand --- .github/workflows/release-drafter.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5e0753d..2b701ed 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -17,14 +17,13 @@ jobs: workflow: sql-odbc-main.yml commit: ${{github.sha}} workflow_conclusion: success - skip_unpack: true + + - name: Pack artifacts + run: tar -cvf artifacts.tar.gz *-installer - name: Draft a release uses: softprops/action-gh-release@v1 with: draft: true generate_release_notes: true - files: | - mac64-installer.zip - windows32-installer.zip - windows64-installer.zip + files: artifacts.tar.gz From 5621738bc4b14a9e7ed5fc261a58be02579e34c0 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Tue, 20 Jun 2023 14:23:24 -0700 Subject: [PATCH 6/9] Apply suggestions from code review Co-authored-by: Sayali Gaikawad <61760125+gaiksaya@users.noreply.github.com> Signed-off-by: Yury-Fridlyand --- jenkins/release.jenkinsFile | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile index fc8d434..0ecb990 100644 --- a/jenkins/release.jenkinsFile +++ b/jenkins/release.jenkinsFile @@ -1,4 +1,4 @@ -lib = library(identifier: 'jenkins@1.5.3', retriever: modernSCM([ +lib = library(identifier: 'jenkins@4.2.2', retriever: modernSCM([ $class: 'GitSCMSource', remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', ])) @@ -8,9 +8,28 @@ standardReleasePipelineWithGenericTrigger( causeString: 'A tag was cut on opensearch-project/sql-odbc repository causing this workflow to run', downloadReleaseAsset: true, publishRelease: true) { - publishToMaven( - signingArtifactsPath: "$WORKSPACE/repository/", - mavenArtifactsPath: "$WORKSPACE/repository/", - autoPublish: true - ) + publishToArtifactsProdBucket( + assumedRoleName: 'sql-odbc-upload-role', + source: 'opensearch-sql-odbc-driver-32-bit-1.5.0.0-Windows.msi', + destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-32-bit-1.5.0.0-Windows.msi', + signingPlatform: 'windows', + sigType: 'null', + sigOverwrite: true + ) + publishToArtifactsProdBucket( + assumedRoleName: 'sql-odbc-upload-role', + source: 'opensearch-sql-odbc-driver-64-bit-1.5.0.0-Windows.msi', + destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-64-bit-1.5.0.0-Windows.msi', + signingPlatform: 'windows', + sigType: 'null', + sigOverwrite: true + ) + publishToArtifactsProdBucket( + assumedRoleName: 'sql-odbc-upload-role', + source: 'opensearch-sql-odbc-driver-64-bit-1.5.0.0-Darwin.pkg, + destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-64-bit-1.5.0.0-Darwin.pkg', + signingPlatform: 'macos', + sigType: 'null', + sigOverwrite: true + ) } From 92bdad816ba68a925fad142473ef1313494247b1 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 22 Jun 2023 12:26:26 -0700 Subject: [PATCH 7/9] Rename artifacts. Signed-off-by: Yury-Fridlyand --- .github/workflows/release-drafter.yml | 7 +++++-- jenkins/release.jenkinsFile | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 2b701ed..b71342a 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -18,8 +18,11 @@ jobs: commit: ${{github.sha}} workflow_conclusion: success - - name: Pack artifacts - run: tar -cvf artifacts.tar.gz *-installer + - name: Rename and pack artifacts + run: | + # replace spaces by dashes in file names + for i in *-installer/*; do mv "$i" "${i//\ /-}"; done + tar -cvf artifacts.tar.gz *-installer - name: Draft a release uses: softprops/action-gh-release@v1 diff --git a/jenkins/release.jenkinsFile b/jenkins/release.jenkinsFile index 0ecb990..6d68eaf 100644 --- a/jenkins/release.jenkinsFile +++ b/jenkins/release.jenkinsFile @@ -10,23 +10,23 @@ standardReleasePipelineWithGenericTrigger( publishRelease: true) { publishToArtifactsProdBucket( assumedRoleName: 'sql-odbc-upload-role', - source: 'opensearch-sql-odbc-driver-32-bit-1.5.0.0-Windows.msi', + source: 'windows32-installer/OpenSearch-SQL-ODBC-Driver-32-bit-1.5.0.0-Windows.msi', destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-32-bit-1.5.0.0-Windows.msi', signingPlatform: 'windows', sigType: 'null', sigOverwrite: true ) - publishToArtifactsProdBucket( + publishToArtifactsProdBucket( assumedRoleName: 'sql-odbc-upload-role', - source: 'opensearch-sql-odbc-driver-64-bit-1.5.0.0-Windows.msi', + source: 'windows64-installer/OpenSearch-SQL-ODBC-Driver-64-bit-1.5.0.0-Windows.msi', destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-64-bit-1.5.0.0-Windows.msi', signingPlatform: 'windows', sigType: 'null', sigOverwrite: true ) - publishToArtifactsProdBucket( + publishToArtifactsProdBucket( assumedRoleName: 'sql-odbc-upload-role', - source: 'opensearch-sql-odbc-driver-64-bit-1.5.0.0-Darwin.pkg, + source: 'mac64-installer/OpenSearch-SQL-ODBC-Driver-64-bit-1.5.0.0-Darwin.pkg', destination: 'opensearch-clients/odbc/opensearch-sql-odbc-driver-64-bit-1.5.0.0-Darwin.pkg', signingPlatform: 'macos', sigType: 'null', From 175172152113abd5fc9f4a3e036c4b495a2da3de Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 22 Jun 2023 17:27:01 -0700 Subject: [PATCH 8/9] Add auto-release approval mechanism. Signed-off-by: Yury-Fridlyand --- .github/workflows/draft-release-notes-workflow.yml | 2 +- .github/workflows/release-drafter.yml | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/draft-release-notes-workflow.yml b/.github/workflows/draft-release-notes-workflow.yml index 2c4567d..f169710 100644 --- a/.github/workflows/draft-release-notes-workflow.yml +++ b/.github/workflows/draft-release-notes-workflow.yml @@ -1,4 +1,4 @@ -name: Release Drafter +name: Release Notes Drafter on: push: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index b71342a..89e1dd0 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -11,6 +11,19 @@ jobs: name: Draft a release runs-on: ubuntu-latest steps: + - id: get_data + run: | + echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '*\n ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT + echo "version=$(cat version.properties)" >> $GITHUB_OUTPUT + - uses: trstringer/manual-approval@v1 + with: + secret: ${{ github.TOKEN }} + approvers: ${{ steps.get_data.outputs.approvers }} + minimum-approvals: 2 + issue-title: 'Release ODBC driver version ${{ steps.get_data.outputs.version }}' + issue-body: "Please approve or deny the release of ODBC Driver **TAG**: ${{ github.ref_name }} **COMMIT**: ${{ github.sha }} **VERSION** : ${{ steps.get_data.outputs.version }} " + exclude-workflow-initiator-as-approver: true + - name: Download artifacts uses: dawidd6/action-download-artifact@v2.27.0 with: From d53218649cde99bff2c0b68a6b3d972acb9485e3 Mon Sep 17 00:00:00 2001 From: Yury-Fridlyand Date: Thu, 22 Jun 2023 17:38:23 -0700 Subject: [PATCH 9/9] Fix getting version. Signed-off-by: Yury-Fridlyand --- .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 89e1dd0..731a193 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -14,7 +14,7 @@ jobs: - id: get_data run: | echo "approvers=$(cat .github/CODEOWNERS | grep @ | tr -d '*\n ' | sed 's/@/,/g' | sed 's/,//1')" >> $GITHUB_OUTPUT - echo "version=$(cat version.properties)" >> $GITHUB_OUTPUT + echo "version=$(grep DRIVER_PACKAGE_VERSION src/CMakeLists.txt | grep -o -P '\d+\.\d+\.\d+\.\d+')" >> $GITHUB_OUTPUT - uses: trstringer/manual-approval@v1 with: secret: ${{ github.TOKEN }}