From c951b622a79d19cb12123e7f3194d7f7dada4e6b Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Fri, 6 Dec 2024 16:07:09 -0500 Subject: [PATCH 1/6] initial setup for release script and docs Signed-off-by: Jordan Dubrick --- release/README.md | 20 ++++++++++ release/release.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 release/README.md create mode 100644 release/release.sh diff --git a/release/README.md b/release/README.md new file mode 100644 index 00000000..57c4c990 --- /dev/null +++ b/release/README.md @@ -0,0 +1,20 @@ +# Cutting New Releases + +## Requirements + +- GitHub CLI (Insert Link Here) + - User logged into CLI with write access to registry-support repo + +## Process + +1. Determine version and type you wish to cut + 1. E.g. "I want to cut version 2.0.0, which is a Major release" + 2. Or "I want to cut version 2.1.0, which is a Minor release" +2. Set the appropriate environment variables + 1. `VERSION` + 2. `RELEASE_TYPE` + 3. `RELEASE_CANDIDATE` - optional, defaults to `false` if unset diff --git a/release/release.sh b/release/release.sh new file mode 100644 index 00000000..efaf3195 --- /dev/null +++ b/release/release.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +# +# Copyright Red Hat +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +TYPES=( + "major" + "minor" +) + +UPSTREAM="https://github.com/devfile/registry-support.git" + + +# $VERSION has to be set by the user in [major].[minor].[patch] format +if [ -z "${VERSION}" ]; then + echo "Environment variable \$VERSION not set. Aborting ..." + exit 1 +fi + +# RELEASE_CANDIDATE should be set to true for major version release candidates +if [ -z "${RELEASE_CANDIDATE}" ]; then + echo "Environment variable \$RELEASE_CANDIDATE not set. Defaulting to false ..." + RELEASE_CANDIDATE=false +fi + +# RELEASE_TYPE should be one of $TYPES defined above +if [ -z "${RELEASE_TYPE}" ]; then + echo "Environment variable \$RELEASE_TYPE not set. Aborting ..." + exit 1 +else + found=false + for type in "${TYPES[@]}"; do + if [ "$type" == "$RELEASE_TYPE" ]; then + found=true + break + fi + done + + if [ "$found" == "false" ]; then + echo "Environment variable \$RELEASE_TYPE set to: "${RELEASE_TYPE}". Must be one of: "${TYPES[@]}" ..." + exit 1 + fi +fi + +exit 0 + +# Set upstream repo tracking if not already set +upstream_name=$(git remote -v | awk -v url="$UPSTREAM" '$2 == url {print $1; exit}') + +# Setup upstream if not set +if [ -n "$upstream_name" ]; then + echo "Upstream repo found ... Name = $upstream_name, url=$UPSTREAM" +else + echo "Upstream not set ..." + echo "Setting upstream to ... Name = release-upstream, url=$UPSTREAM" + git remote add release-upstream $UPSTREAM + upstream_name="release-upstream" +fi + + +if [ "${RELEASE_TYPE}" == "major" ] && [ "${RELEASE_CANDIDATE}" == "true" ]; then + # the release associated with this tag will be a pre-release, and we should be moving the code to a rc/ branch alongside the prev release + echo "Major release and release-candidate" + fetch_push_prior_commit + git push $upstream_name $upstream_name/main:rc/$VERSION + git tag $VERSION-rc + git push $upstream_name $VERSION-rc +else + # major/minor normal workflow + echo "Major or Minor release" + fetch_push_prior_commit + # Create new tag in upstream + git tag $VERSION + git push $upstream_name $VERSION +fi + +fetch_push_prior_commit () { + git fetch $upstream_name --tags + LATEST_TAG=$(git tag --sort=-v:refname | head -n 1) + MODIFIED_TAG=$(echo "$LATEST_TAG" | awk -F. '{print $1 "." $2 ".x"}') # convert to [major].[minor].x format from [major].[minor].[patch] + git checkout -b test-fetch-tag $LATEST_TAG #TODO: fix the test-fetch-tag to something better + git push $upstream_name release/$MODIFIED_TAG + + # navigate back to main + git checkout main +} \ No newline at end of file From aa7923f4638a677be1865066aef3977db1066fa0 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Mon, 9 Dec 2024 14:09:54 -0500 Subject: [PATCH 2/6] update readme and finalize script Signed-off-by: Jordan Dubrick --- release/README.md | 46 +++++++++++++++++++++++++++++----- release/release.sh | 62 +++++++++++++++++++++++++--------------------- 2 files changed, 74 insertions(+), 34 deletions(-) diff --git a/release/README.md b/release/README.md index 57c4c990..19236e1e 100644 --- a/release/README.md +++ b/release/README.md @@ -1,11 +1,10 @@ # Cutting New Releases ## Requirements - -- GitHub CLI (Insert Link Here) - - User logged into CLI with write access to registry-support repo + +- SSH key setup with GitHub + - See [GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) for more information +- Write access to the [devfile/registry-support](https://github.com/devfile/registry-support) repository ## Process 1. Determine version and type you wish to cut 1. E.g. "I want to cut version 2.0.0, which is a Major release" 2. Or "I want to cut version 2.1.0, which is a Minor release" From b90c4d64ccd1e21632d30eda752ea97d3cafbad8 Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Mon, 9 Dec 2024 16:11:21 -0500 Subject: [PATCH 4/6] update readme with ref to process doc Signed-off-by: Jordan Dubrick --- release/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release/README.md b/release/README.md index db0ebd00..02720072 100644 --- a/release/README.md +++ b/release/README.md @@ -7,6 +7,11 @@ - Write access to the [devfile/registry-support](https://github.com/devfile/registry-support) repository ## Process + +Information related to the release process can be found [here](https://docs.google.com/document/d/1JYnQf0M2VcZhJuHn6dxPEYNZ7icoViqJe8dN1jnKsCw/edit?usp=sharing). + +In order to use the script you will need to consider and set the following: + 1. Determine version and type you wish to cut 1. E.g. "I want to cut version 2.0.0, which is a Major release" 2. Or "I want to cut version 2.1.0, which is a Minor release" From b03702df810086b1bd00601188d55dc6e9b7b55f Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Tue, 10 Dec 2024 13:43:04 -0500 Subject: [PATCH 5/6] add release process google doc as md file Signed-off-by: Jordan Dubrick --- release/PROCESS.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++ release/release.sh | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 release/PROCESS.md diff --git a/release/PROCESS.md b/release/PROCESS.md new file mode 100644 index 00000000..94c93485 --- /dev/null +++ b/release/PROCESS.md @@ -0,0 +1,58 @@ +# Release Process + +## Versioning + +The [`devfile/registry-support`](https://github.com/devfile/registry-support) repository has three kinds of releases and follows the [SemVer](https://semver.org/) format. Following this format we have the following: + +- v[major].[minor].[patch] +- v[major].[minor].[patch]-rc for release-candidates + +**Major** releases occur when there are changes towards the functionality of the registry support tool. Typically major releases will include significant feature changes with no guarantee of compatibility (usually part of a milestone), and changes from previous minor and patch releases. In addition to this, whenever a change is made to the API that breaks functionality, a major release will be cut. When a major release is cut there is no guarantee that prior Golang versions will or can be supported. + +When a new release is cut the previous release will receive a dedicated release branch. For example, when `v2.1.0` is cut, the previous release, `v2.0.0` will receive a new branch named `release/v2.0.x`. + +**Minor** releases occur when minor bug fixes, security patches, and regular feature changes are added. In addition, a minor release occurs when a new Golang version is released. Similiar to major releases, minor releases will receive a dedicated backport branch. + +**Patch** releases only occur if a release needs to be cut outside of the normal release schedule/process. Patches should *only* include **critical** bug fixes and **critical** security patches that do not break the current release. Patches are tied to the latest minor release and are strongly recommended to end users. These patch releases have the potential to be backported to prior releases supporting different Golang versions. + +**Pre-releases** happen for planned upcoming major releases to ensure all changes work as intended and gives a window for earlier adopters to try out the new major version. These pre-releases will receive a dedicated branch and will be post-fixed with `-rc`. For example, for a release `v3.0.0` that is marked as pre-release, a dedicated branch will be created named `rc/v3.0.0` and will be tagged `v3.0.0-rc`. + +## Schedule + +Major releases will be cut on an as-needed basis when major changes are made to how the application works. + +Minor releases will roughly follow the release schedule of Golang, however, releases for feature additions, security fixes, and more can also be done on an as-needed basis. + +## Changes + +Release changes will consist of the merged PRs since the previous release that are made to the `main` branch. Patch changes made to a specific release branch would need to be backported to prior releases if necessary and the versioning would be adjusted accordingly. + +### Noteworthy Changes + +Noteworthy changes should have the following criteria: +- Features should only include changes which directly impacts the user +- Go version should include any updates regarding a new go version being supported +- Bug fixes should include changes reported outside the team +- (Optional) Security Patches should include all changes + - **Note**: Process of labelling security patches needs to be in place before we can identify them in release announcements, leaving as optional to the assignee’s discretion +- Documentation should include any change reported outside the team or highlights a feature of note + +Changes within PRs can be highlighted as well with the PR as a base change. + + +## Cutting Releases + +Individuals performing releases can find more information related to the process below. + +### Major Releases + +- See the dedicated release documentation [here](./README.md). + +### Minor Releases + +- See the dedicated release documentation [here](./README.md). + +### Patch Releases + +- See the dedicated release documentation [here](./README.md). +- If necessary, backport the change to the previous 2 releases. \ No newline at end of file diff --git a/release/release.sh b/release/release.sh index 52e47cb0..9cdec09b 100644 --- a/release/release.sh +++ b/release/release.sh @@ -93,7 +93,7 @@ fi if [ "${RELEASE_TYPE}" == "major" ] && [ "${RELEASE_CANDIDATE}" == "true" ]; then # the release associated with this tag will be a pre-release, and we should be moving the code to a rc/ branch alongside the prev release fetch_push_prior_release - git push $upstream_name $upstream_name/main:refs/heads/rc/$VERSION + git push $upstream_name $upstream_name/main:refs/heads/rc/v$VERSION tag_and_push rc elif [ "${RELEASE_TYPE}" == "patch" ]; then tag_and_push From c63f436e81d2e3e0199ad2c3b9e641973ba33b6b Mon Sep 17 00:00:00 2001 From: Jordan Dubrick Date: Tue, 10 Dec 2024 14:34:04 -0500 Subject: [PATCH 6/6] consolidate into one readme Signed-off-by: Jordan Dubrick --- release/PROCESS.md | 42 +++++++++++++++++++++++++++++----- release/README.md | 56 ---------------------------------------------- 2 files changed, 36 insertions(+), 62 deletions(-) delete mode 100644 release/README.md diff --git a/release/PROCESS.md b/release/PROCESS.md index 94c93485..d517b02b 100644 --- a/release/PROCESS.md +++ b/release/PROCESS.md @@ -42,17 +42,47 @@ Changes within PRs can be highlighted as well with the PR as a base change. ## Cutting Releases -Individuals performing releases can find more information related to the process below. +Individuals performing releases can find more information related to the process below. After the use of the release script you will have all the required branches and GitHub tags created for you. The final steps will be to create the [release on GitHub](https://github.com/devfile/registry-support/releases/new), and send out a release notification to users. + +### Requirements + +- SSH key setup with GitHub + - See [GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) for more information +- Write access to the [devfile/registry-support](https://github.com/devfile/registry-support) repository + ### Major Releases -- See the dedicated release documentation [here](./README.md). +Example major release: +``` +export VERISON=1.1.1 +export RELEASE_TYPE=major +bash release.sh +``` + +Example major release as a pre-release: +``` +export VERSION=2.0.0 +export RELEASE_CANDIDATE=true +export RELEASE_TYPE=major +bash release.sh +``` ### Minor Releases -- See the dedicated release documentation [here](./README.md). - +Example minor release: +``` +export VERSION=2.1.0 +export RELEASE_TYPE=minor +bash release.sh +``` ### Patch Releases -- See the dedicated release documentation [here](./README.md). -- If necessary, backport the change to the previous 2 releases. \ No newline at end of file +Example patch release: +``` +export VERSION=2.1.1 +export RELEASE_TYPE=patch +bash release.sh +``` + +If necessary, backport the changes to the previous 2 releases. \ No newline at end of file diff --git a/release/README.md b/release/README.md deleted file mode 100644 index 02720072..00000000 --- a/release/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Cutting New Releases - -## Requirements - -- SSH key setup with GitHub - - See [GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) for more information -- Write access to the [devfile/registry-support](https://github.com/devfile/registry-support) repository - -## Process - -Information related to the release process can be found [here](https://docs.google.com/document/d/1JYnQf0M2VcZhJuHn6dxPEYNZ7icoViqJe8dN1jnKsCw/edit?usp=sharing). - -In order to use the script you will need to consider and set the following: - -1. Determine version and type you wish to cut - 1. E.g. "I want to cut version 2.0.0, which is a Major release" - 2. Or "I want to cut version 2.1.0, which is a Minor release" -2. Set the appropriate environment variables - 1. `VERSION` - - In the form [Major].[Minor].[Patch] - 2. `RELEASE_TYPE` - - One of [major, minor, patch] - 3. `RELEASE_CANDIDATE` - - Defaults to `false` if unset - - Only applicable for `major` release types - -## Examples - -Major release v1.1.1 -``` -export VERISON=1.1.1 -export RELEASE_TYPE=major -bash release.sh -``` - -Major release v2.0.0 that is a release candidate -``` -export VERSION=2.0.0 -export RELEASE_CANDIDATE=true -export RELEASE_TYPE=major -bash release.sh -``` - -Minor release v2.1.0 -``` -export VERSION=2.1.0 -export RELEASE_TYPE=minor -bash release.sh -``` - -Patch release v2.1.1 -``` -export VERSION=2.1.1 -export RELEASE_TYPE=patch -bash release.sh -``` \ No newline at end of file