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

build(release): add release workflow #2829

Merged
merged 12 commits into from
Jun 27, 2024
Merged

build(release): add release workflow #2829

merged 12 commits into from
Jun 27, 2024

Conversation

hairyhum
Copy link
Contributor

@hairyhum hairyhum commented Apr 18, 2024

Change Overview

Release workflow will:

  • Create and push a release tag
  • Produce release using goreleaser with binaries and helm charts
  • Build docs from docs_new
  • Publish docs and helm charts index in the github pages

Main changes

  • Created a release workflow to run either on workflow_dispatch or on merge with specific commit message: pre-release: Update version to ... format for merge commits of PRs like pre-release: Update version to 0.0.0 #2814
    • This will create some cancelled workflows because of the way filters work on GHA, but hopefully that's not a big deal
  • Moved example image build from the goreleaser to a separate reusable workflow, so they no longer break the release even if they fail, we can even call this workflow separately from workflow_dispatch if we want
  • Added helm packages to the artifacts of the release, so they now hosted by github
  • Enabled new docs build and publish to github pages together with the helm charts index file @mlavi we will need to point our DNS to those locations now
  • Enabled ability to build pre-releases by supplying tag names like x.x.x-rc1. Mostly for test purposes. Those will be created as pre-releases in the github.

Changes in helm chart publishing

Helm charts are now published as release artifacts. Helm chart index is published in the github pages together with docs (just in a separate directory).

Helm chart index source is still taken from charts.kanister.io, so before we change the DNS it will include references to the old charts in S3.
For some time I believe we will be publishing to both S3 and github release/github pages.

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test
  • 🏗️ build

Test Plan

Test release

There is a ci-release-test branch which can be used to create test releases.

One way to do that is to run workflow dispatch:

gh workflow run release.yaml -r ci-release-test -F release_tag=0.107.0-rc1 -F draft_release=true

Another is to push a commit with the pre-release message format: pre-release: Update version to 0.107.0-rc2 (placeholder) (don't forget the placeholder, merge commits have the PR reference there)

This will create a tag, build images and publish a draft release on github. You can track the progress in https://github.com/kanisterio/kanister/actions/workflows/release.yaml

If tag already exists in github, the workflow will fail, so please use new tags when testing.

Example runs:

@hairyhum hairyhum force-pushed the ci-release branch 29 times, most recently from 8c8c8ed to b5540aa Compare April 18, 2024 22:21
.github/workflows/build_example_images.yaml Outdated Show resolved Hide resolved
.goreleaser.yml Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
Copy link
Contributor

@e-sumin e-sumin left a comment

Choose a reason for hiding this comment

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

LGTM
but since I'm not an expert in github actions, I'd like somebody else to look on them too

RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
RELEASE.md Outdated Show resolved Hide resolved
Release workflow will:
- Create and push a release tag
- Produce release using goreleaser with binaries and helm charts, this does not build example images
- Build docs from docs_new
- Publish docs and helm charts index in the github pages
- Separately build example images for the tag
Copy link
Contributor

@viveksinghggits viveksinghggits left a comment

Choose a reason for hiding this comment

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

Left some smaller comments.

RELEASE.md Outdated
Release process:

- Verify the release version by looking at the [releases page](https://github.com/kanisterio/kanister/releases) on the Kanister repo.
- Trigger the [pre-release](#pre-release-workflow) workflow with the desired version number (e.g. bump the minor version portion 0.106.0 -> 0.107.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Trigger the [pre-release](#pre-release-workflow) workflow with the desired version number (e.g. bump the minor version portion 0.106.0 -> 0.107.0)
- Trigger the [pre-release](#pre-release-workflow) workflow with the desired version number (e.g. bump the minor version portion 0.106.0 -> 0.107.0), which will result in a PR getting created in Kanister repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

RELEASE.md Outdated
Comment on lines 13 to 14
- The Kanister release job will publish a new tag, update documentation, build all the docker images, and push them to the [ghcr.io](https://github.com/orgs/kanisterio/packages) registry.
- Once the job is complete, a Slack notification will be sent to the kanister channel.
Copy link
Contributor

Choose a reason for hiding this comment

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

Other points don't have full stop at the end, these two points have.
Also, we have not implemented the slack notification yet, should be just remove this point or strikethrough it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

RELEASE.md Outdated

### Pre-release workflow

`pre-release` workflow serves to create a new version of kanister, it updates version number and creates a PR in kanister repo.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`pre-release` workflow serves to create a new version of kanister, it updates version number and creates a PR in kanister repo.
`pre-release` workflow serves to create a new version of kanister, and updates the older version number in source files of kanister repo with new version and creates a PR in kanister repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated


- Verify if the docker [images](https://github.com/orgs/kanisterio/packages?repo_name=kanister) have a new tag. NOTE: Not all docker images are relevant.
TODO: Add a list of the most relevant docker images to be verified here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add another point here about updating the helm repo and checking that new version of chart is updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

If pre-release pipeline does not work.

```
$ export PREV_TAG="0.42.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

If I didn't misread things, when the pre-release happens using actions we documented above that we are supposed to give the new version that we want to release kanister with. For example if the latest tag in kanister repo is 0.101.0 we are supposed to give 0.102.0.
But here we are saying we have to give the previous tag? If that is the case, it might be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added clarification

@hairyhum
Copy link
Contributor Author

hairyhum commented Jun 27, 2024

Test run can be found here: https://github.com/kanisterio/kanister/actions/runs/9699450217
Draft release: https://github.com/kanisterio/kanister/releases/tag/untagged-245269bca9f139750189

Note that changelog is missing because release notes are note present in the repo ATM

@hairyhum hairyhum merged commit f8bb6c4 into master Jun 27, 2024
16 checks passed
@hairyhum hairyhum deleted the ci-release branch June 27, 2024 17:27
Copy link
Contributor

@julio-lopez julio-lopez left a comment

Choose a reason for hiding this comment

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

@hairyhum Please see inline comments. Thanks.

docs_new/.vitepress/config.mts Outdated Show resolved Hide resolved
${{ inputs.extra_tags }}
labels: ${{ inputs.labels }}
- name: Build and push
uses: docker/build-push-action@v5
Copy link
Contributor

@julio-lopez julio-lopez Jul 2, 2024

Choose a reason for hiding this comment

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

@hairyhum Please pin the version for this action using its digest. For an example, see how the action is specified in the previous step.

The OSSF workflow also checks for this, as it considers it a good practice.

export HELM_RELEASE_REPO_INDEX=https://charts.kanister.io/
make package-helm VERSION=${RELEASE_TAG}
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
Copy link
Contributor

Choose a reason for hiding this comment

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

Please tag this action's version. It should not use a "floating" tag or repo branch name.

GHCR_LOGIN_USER: ${{ github.actor }}
GORELEASE_PARAMS: ${{ env.DRAFT_RELEASE == 'true' && '--draft' || '' }}
## Upload to use in docs publishing
- uses: actions/upload-artifact@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

package_json_file: docs_new/package.json
version: 8
- name: Setup Node
uses: actions/setup-node@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

with:
ref: ${{ env.RELEASE_TAG }}
- name: Setup pnpm
uses: pnpm/action-setup@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

with:
node-version: 20
- name: Setup Pages
uses: actions/configure-pages@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

run: pnpm docs:build
working-directory: ./docs_new
- name: download helm index
uses: actions/download-artifact@v4
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

name: helm-index
path: docs_new/.vitepress/dist/helm_charts/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

pin action version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants