Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboard 1-click release process #52

Merged
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Yury-Fridlyand Looks good!
One minor recommendation, there is a 2PR approval process we recently on added (that's why missing from jdbc repo I believe).
Can you add that as well?
Sample code: https://github.com/opensearch-project/spring-data-opensearch/blob/main/.github/workflows/release-drafter.yml#L16-L27

Sorry about that not sure how I missed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 1751721

steps:
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2.27.0
with:
workflow: sql-odbc-main.yml
commit: ${{github.sha}}
workflow_conclusion: success
Comment on lines +28 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also will the Release drafter wait until sql-odbc-main.yml completes? How does this work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow fails if main CI workflow is not completed yet or failed. But it can be manually restarted to get fresh CI results later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See example in https://github.com/Bit-Quill/sql-odbc/actions/runs/5349394842/jobs/9700551170
Automatic run (attempt 1):
image
Restarted later (attempt 2):
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see! Thanks! Wondering if something like trigger and wait will be helpful than failing and retrying always?
Because when you push a tag sql-odbc-main.yml will run too due to push event of tag. So I believe it will fail everytime and we need to retry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this workflow can uses GHA run triggered by last merge commit on main. Cutting a tag on that commit will just re-run it.
I agree that it is not the best option, it needs more testing. I can update it and use wait-on-check action later.


- 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: artifacts.tar.gz
40 changes: 40 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -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/<thing>`. 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).
35 changes: 35 additions & 0 deletions jenkins/release.jenkinsFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
lib = library(identifier: 'jenkins@4.2.2', 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) {
publishToArtifactsProdBucket(
assumedRoleName: 'sql-odbc-upload-role',
source: 'opensearch-sql-odbc-driver-32-bit-1.5.0.0-Windows.msi',
gaiksaya marked this conversation as resolved.
Show resolved Hide resolved
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
)
}
2 changes: 2 additions & 0 deletions release-notes/sql-odbc.OpenSearch.release-notes-1.5.0.0.md
Original file line number Diff line number Diff line change
@@ -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)