diff --git a/Makefile b/Makefile index dc90350..0df2611 100644 --- a/Makefile +++ b/Makefile @@ -290,7 +290,7 @@ gosec: gosec -no-fail -fmt=sarif -out=gosec.sarif -exclude-dir pkg/test -exclude-dir tests ./... ### Release -# RUN: make release new-version=x.x.x +# RUN: make release NEW_VERSION=x.x.x .PHONY: release: - sh make-release.sh ${new-version} \ No newline at end of file + sh make-release.sh ${NEW_VERSION} \ No newline at end of file diff --git a/README.md b/README.md index 5add92c..a6ede79 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,6 @@ Releases are available on [GitHub](https://github.com/devfile/registry-operator/ For more updates on releases, please join our [communication channels](https://devfile.io/docs/2.2.2/community#getting-involved). -## Preparing Releases -A script has been created to make the release process more efficient. This script takes care of all changes to version numbers in all necessary files. Additionally this script opens the initial PR to devfile/registry-operator. The release engineer will be responsible for running this script with the instructions below. - -1. Navigate to main branch of your forked registry-operator repository. -2. Run `make release new-version=x.x.x` where x.x.x is the version you are trying to cut. -3. Edit the PR opened by the script on devfile/registry-operator to include a proper description. - ## Issue Tracking Issue tracking repo: https://github.com/devfile/api with label area/registry @@ -104,6 +97,7 @@ The repository contains a Makefile; building and deploying can be configured via | `TARGET_OS` | Target operating system for operator manager build, **only for `make manager`** | `linux` | | `PLATFORMS` | Target architecture(s) for `make docker-buildx` | All supported: `linux/arm64,linux/amd64,linux/s390x,linux/ppc64le` | | `KUSTOMIZE_INSTALL_SCRIPT` | URL of kustomize installation script, see [kustomize installation instructions](https://kubectl.docs.kubernetes.io/installation/kustomize/binaries/) | `https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh` | +| `NEW_VERSION` | Release version being cut | | Some of the rules supported by the makefile: @@ -131,6 +125,7 @@ Some of the rules supported by the makefile: | fmt_license | Ensure license header is set on all files | | vet | Check suspicious constructs into code | | gosec | Check for security problems in non-test source files | +| release | Starts the process for cutting a new release | To see all rules supported by the makefile, run `make help` diff --git a/make-release.sh b/make-release.sh index 07c3416..c827b4b 100644 --- a/make-release.sh +++ b/make-release.sh @@ -18,19 +18,17 @@ set -eu usage () -{ echo "Usage: ./make-release.sh " +{ echo "Usage: make release NEW_VERSION=" exit } if [[ $# -lt 1 ]]; then usage; fi + SCHEMA_VERSION=$1 FIRST_DIGIT="${SCHEMA_VERSION%%.*}" RELEASE_BRANCH="release-v${FIRST_DIGIT}" DEVFILE_REPO="git@github.com:devfile/registry-operator.git" -## This will be uncommented for actual devfile repo -#RELEASE_UPSTREAM_NAME="devfile-upstream-release" -# This goes to my origin for testing -RELEASE_UPSTREAM_NAME="origin" +RELEASE_UPSTREAM_NAME="devfile-upstream-release" if ! command -v hub > /dev/null; then echo "[ERROR] The hub CLI needs to be installed. See https://github.com/github/hub/releases" @@ -75,34 +73,34 @@ checkoutToReleaseBranch() { resetChanges $SCHEMA_VERSION else echo "[INFO] $SCHEMA_VERSION does not exist. Will create a new one from main." - resetChanges release-automation #change release-automation to main after testing - git push origin release-automation:$SCHEMA_VERSION + resetChanges main + git push origin main:$SCHEMA_VERSION fi git checkout -B $SCHEMA_VERSION } updateVersionNumbers() { - SHORT_UNAME=$(uname -s) - - ## Updating version.md based off of operating system - if [ "$(uname)" == "Darwin" ]; then - sed -i '' "s/^.*$/$SCHEMA_VERSION/" VERSION - elif [ "${SHORT_UNAME:0:5}" == "Linux" ]; then - sed -i "s/^.*$/$SCHEMA_VERSION/" VERSION - fi - - ## Remaining version number updates to yaml files - yq eval ".metadata.annotations.containerImage = \"quay.io/devfile/registry-operator:v$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml - yq eval ".metadata.name = \"registry-operator.v$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml - yq eval ".spec.version = \"$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml + SHORT_UNAME=$(uname -s) + + ## Updating version.md based off of operating system + if [ "$(uname)" == "Darwin" ]; then + sed -i '' "s/^.*$/$SCHEMA_VERSION/" VERSION + elif [ "${SHORT_UNAME:0:5}" == "Linux" ]; then + sed -i "s/^.*$/$SCHEMA_VERSION/" VERSION + fi + + ## Remaining version number updates to yaml files + yq eval ".metadata.annotations.containerImage = \"quay.io/devfile/registry-operator:v$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml + yq eval ".metadata.name = \"registry-operator.v$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml + yq eval ".spec.version = \"$SCHEMA_VERSION\"" --inplace ./config/manifests/bases/registry-operator.clusterserviceversion.yaml } # Export env variables that are used in bundle scripts exportEnvironmentVariables() { - CHANNEL=$(yq eval '.annotations."operators.operatorframework.io.bundle.channels.v1"' ./bundle/metadata/annotations.yaml) - export IMG=quay.io/devfile/registry-operator:v$SCHEMA_VERSION - export CHANNELS=$CHANNEL + CHANNEL=$(yq eval '.annotations."operators.operatorframework.io.bundle.channels.v1"' ./bundle/metadata/annotations.yaml) + export IMG=quay.io/devfile/registry-operator:v$SCHEMA_VERSION + export CHANNELS=$CHANNEL } # Commits version changes to your forked repository @@ -117,7 +115,7 @@ commitChanges() { # with the name release-vX ## This func will be used when we have a new major release and there is no branch in the upstream repo createNewReleaseBranch(){ - git checkout -b "${RELEASE_BRANCH}" release-automation #change to main after testing + git checkout -b "${RELEASE_BRANCH}" main git push "${RELEASE_UPSTREAM_NAME}" "${RELEASE_BRANCH}" } @@ -134,11 +132,11 @@ verifyReleaseBranch() { createPullRequest(){ echo "[INFO] Creating a PR" - hub pull-request --base jdubrick:${RELEASE_BRANCH} --head ${SCHEMA_VERSION} -m "$1" #jdubrick changes to devfile + hub pull-request --base devfile:${RELEASE_BRANCH} --head ${SCHEMA_VERSION} -m "$1" } main(){ - #setUpstream -- LEAVE COMMENTED AS THIS WILL SET MY ORIGIN TO DEVFILE + setUpstream checkoutToReleaseBranch updateVersionNumbers exportEnvironmentVariables