From 36198621ec0d11410706c4c17921fb66e7975431 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Tue, 19 Mar 2024 19:03:11 -0700 Subject: [PATCH 1/5] Create Release workflow Problem: Manually updating the old tag is boring and error prone Solution: Automate the process and automatically open a PR for the release --- .github/CHANGELOG_TEMPLATE.md | 36 ++++++++++++++++ .github/workflows/nfr.yml | 3 +- .github/workflows/release-pr.yml | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 .github/CHANGELOG_TEMPLATE.md create mode 100644 .github/workflows/release-pr.yml diff --git a/.github/CHANGELOG_TEMPLATE.md b/.github/CHANGELOG_TEMPLATE.md new file mode 100644 index 0000000000..446c67e12a --- /dev/null +++ b/.github/CHANGELOG_TEMPLATE.md @@ -0,0 +1,36 @@ + +## Release %%VERSION%% + +%%DATE%% + +FEATURES: + +- + +BUG FIXES: + +- + +DOCUMENTATION: + +- + +HELM CHART: + +- The version of the Helm chart is now %%VERSION%% +- + +UPGRADE: + +- + +COMPATIBILITY: + +- The Gateway API version: `` +- NGINX version: `` +- Kubernetes version: `` + +CONTAINER IMAGES: + +- Control plane: `ghcr.io/nginxinc/nginx-gateway-fabric:%%VERSION%%` +- Data plane: `ghcr.io/nginxinc/nginx-gateway-fabric/nginx:%%VERSION%%` diff --git a/.github/workflows/nfr.yml b/.github/workflows/nfr.yml index 31f661c4df..76220e9bff 100644 --- a/.github/workflows/nfr.yml +++ b/.github/workflows/nfr.yml @@ -46,8 +46,6 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 - with: - token: ${{ secrets.NGINX_PAT }} - name: Setup Golang Environment uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 @@ -165,6 +163,7 @@ jobs: token: ${{ secrets.NGINX_PAT }} commit-message: NFR Test Results for NGF version ${{ inputs.version }} ${{ inputs.nginx_plus == true && '(Plus)' || ''}} author: nginx-bot + committer: nginx-bot branch: tests/nfr-tests-${{ inputs.version }}${{ inputs.nginx_plus == true && '-plus' || ''}} delete-branch: true title: NFR Test Results for NGF version ${{ inputs.version }} ${{ inputs.nginx_plus == true && '(Plus)' || ''}} diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml new file mode 100644 index 0000000000..ec4385ccc9 --- /dev/null +++ b/.github/workflows/release-pr.yml @@ -0,0 +1,72 @@ +name: Release PR + +on: + workflow_dispatch: + inputs: + version: + description: "Version to release" + required: true + default: "0.0.0" + +defaults: + run: + shell: bash + +jobs: + release: + runs-on: ubuntu-22.04 + steps: + - name: Branch + id: branch + run: | + version=${{ github.event.inputs.version }} + version=${version%.*} + echo "branch=release-$version" >> $GITHUB_OUTPUT + + - name: Checkout Repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + ref: ${{ steps.branch.outputs.branch }} + + - name: Vars + id: vars + run: | + echo "current_version=$(yq '.version' > $GITHUB_OUTPUT + + - name: Find and Replace + uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2 + with: + find: ${{ steps.vars.outputs.current_version }} + replace: ${{ inputs.version }} + include: "site/content/**/*.md" + regex: false + + - name: Find and Replace + uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2 + with: + find: "edge" + replace: ${{ inputs.version }} + include: "deploy/helm-chart/*.yaml" + regex: false + + - name: Generate manifests and changelog + run: | + sed -i -e "s/${current_version}/${{ inputs.version }}/g" README.md + sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile + sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" tests/Makefile + sed -i -e "s/TAG = edge/TAG = ${{ inputs.version }}/g" conformance/Makefile + sed -i "5r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md + sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md + make generate-manifests + + - name: Create Pull Request + uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 + with: + token: ${{ secrets.NGINX_PAT }} + commit-message: Release ${{ inputs.version }} + title: Release ${{ inputs.version }} + branch: docs/release-${{ inputs.version }} + author: nginx-bot + committer: nginx-bot + body: | + This automated PR updates all the necessary files for ${{ inputs.version }} release. From 1dc4010ed702263b0041fce880c833b915f0e011 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 20 Mar 2024 09:46:35 -0700 Subject: [PATCH 2/5] fix sed --- .github/workflows/release-pr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index ec4385ccc9..a686f3ca9e 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -51,10 +51,10 @@ jobs: - name: Generate manifests and changelog run: | - sed -i -e "s/${current_version}/${{ inputs.version }}/g" README.md + sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile - sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" tests/Makefile - sed -i -e "s/TAG = edge/TAG = ${{ inputs.version }}/g" conformance/Makefile + sed -i -e "s/VERSION = ${{ steps.vars.outputs.current_version }}/VERSION = ${{ inputs.version }}/g" conformance/Makefile + sed -i -e "s/TAG = edge/TAG = ${{ inputs.version }}/g" **/Makefile sed -i "5r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md make generate-manifests From 7bc538772da6a0789bff5ccabe444edaf0b9387e Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 20 Mar 2024 11:18:54 -0700 Subject: [PATCH 3/5] Add Plus --- .github/CHANGELOG_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CHANGELOG_TEMPLATE.md b/.github/CHANGELOG_TEMPLATE.md index 446c67e12a..1c6c08c8cd 100644 --- a/.github/CHANGELOG_TEMPLATE.md +++ b/.github/CHANGELOG_TEMPLATE.md @@ -1,4 +1,3 @@ - ## Release %%VERSION%% %%DATE%% @@ -34,3 +33,4 @@ CONTAINER IMAGES: - Control plane: `ghcr.io/nginxinc/nginx-gateway-fabric:%%VERSION%%` - Data plane: `ghcr.io/nginxinc/nginx-gateway-fabric/nginx:%%VERSION%%` +- Data plane with NGINX Plus: `private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:%%VERSION%%` From 3215f6dfe02076b5c5a436ef75400e46103ddaa0 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 20 Mar 2024 12:42:27 -0700 Subject: [PATCH 4/5] Update release doc --- .github/workflows/release-pr.yml | 10 ++++++- deploy/helm-chart/Chart.yaml | 2 +- docs/developer/release-process.md | 49 +++++++++++++------------------ 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index a686f3ca9e..d8e5e2b0fe 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -31,7 +31,7 @@ jobs: - name: Vars id: vars run: | - echo "current_version=$(yq '.version' > $GITHUB_OUTPUT + echo "current_version=$(yq '.appVersion' > $GITHUB_OUTPUT - name: Find and Replace uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2 @@ -49,6 +49,14 @@ jobs: include: "deploy/helm-chart/*.yaml" regex: false + - name: Find and Replace + uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2 + with: + find: "Always" + replace: "IfNotPresent" + include: "deploy/helm-chart/*.yaml" + regex: false + - name: Generate manifests and changelog run: | sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md diff --git a/deploy/helm-chart/Chart.yaml b/deploy/helm-chart/Chart.yaml index 7285ae509c..c64c15848c 100644 --- a/deploy/helm-chart/Chart.yaml +++ b/deploy/helm-chart/Chart.yaml @@ -3,7 +3,7 @@ name: nginx-gateway-fabric description: NGINX Gateway Fabric type: application version: 1.1.0 -appVersion: "edge" +appVersion: "1.1.0" home: https://github.com/nginxinc/nginx-gateway-fabric icon: https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/main/deploy/helm-chart/chart-icon.png sources: diff --git a/docs/developer/release-process.md b/docs/developer/release-process.md index 16a969e008..64d4e5e1ab 100644 --- a/docs/developer/release-process.md +++ b/docs/developer/release-process.md @@ -30,36 +30,27 @@ To create a new release, follow these steps: 3. Test the main branch for release-readiness. For that, use the `edge` containers, which are built from the main branch, and run the following: 1. Run the [example applications](/examples) manually and verify their correctness. - 2. Kick off the [NFR workflow](https://github.com/nginxinc/nginx-gateway-fabric/actions/nfr.yml) in the browser. For `image_tag`, use `edge`, and for `version`, use the upcoming `X.Y.Z` NGF version. This will run all of the NFR tests which are automated and open a PR with the results files when it is complete. Review this PR and make any necessary changes before merging. + 2. Kick off the [NFR workflow](https://github.com/nginxinc/nginx-gateway-fabric/actions/nfr.yml) in the browser. For `image_tag`, use `edge`, and for `version`, use the upcoming `X.Y.Z` NGF version. This will run all of the NFR tests which are automated and open a PR with the results files when it is complete. Review this PR and make any necessary changes before merging. 4. If a problem is found, prepare a fix PR, merge it into the main branch and return to the previous step. 5. If the supported Gateway API minor version has changed since the last release, test NGINX Gateway Fabric with the previous version of the Gateway API CRDs. 6. If a compatibility issue is found, add a note to the release notes explaining that the previous version is not supported. 7. Create a release branch following the `release-X.Y` naming convention. -8. Prepare and merge a PR into the **release branch** to update the repo files for the release: - 1. Update the Helm [Chart.yaml](/deploy/helm-chart/Chart.yaml): the `appVersion` to `X.Y.Z`, the icon and source - URLs to point at `vX.Y.Z`, and bump the `version`. - 2. Adjust the `VERSION` variable in the [Makefile](/Makefile) and the `TAG` in the - [conformance tests Makefile](/conformance/Makefile) to `X.Y.Z`. - 3. Update the tag of NGF container images used in the Helm [values.yaml](/deploy/helm-chart/values.yaml) file, - the [provisioner manifest](/conformance/provisioner/provisioner.yaml), and all docs to `X.Y.Z`. - 4. Ensure that the `imagePullPolicy` is `IfNotPresent` in the Helm [values.yaml](/deploy/helm-chart/values.yaml) - file. - 5. Generate the installation manifests by running `make generate-manifests`. - 6. Modify any `git clone` instructions to use `vX.Y.Z` tag. - 7. Modify any docs links that refer to `main` to instead refer to `vX.Y.Z` or `release-x-y`, whichever is applicable. - 8. Update any installation instructions to ensure that the supported Gateway API and NGF versions are correct. - Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`. - 9. Update the [README](/README.md) to include information about the release. - 10. Update the [changelog](/CHANGELOG.md). The changelog includes only important (from the user perspective) - changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next - step. As a starting point, copy the important features, bug fixes, and dependencies from the autogenerated - draft of the full changelog. This draft can be found under - the [GitHub releases](https://github.com/nginxinc/nginx-gateway-fabric/releases) after the release branch is - created. Use the previous changelog entries for formatting and content guidance. +8. Run the [Release PR](./../../.github/workflows/release-pr.yml) workflow to update the repo files for the release. Then there are a few manual steps to complete: + 1. Update the tag of NGF container images used in the [provisioner manifest](/conformance/provisioner/provisioner.yaml). + 2. Update any installation instructions to ensure that the supported Gateway API is correct. + Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`. + 3. Update the [README](/README.md) to include information about the release. + 4. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly. + The changelog includes only important (from the user perspective) + changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next + step. As a starting point, copy the important features, bug fixes, and dependencies from the autogenerated + draft of the full changelog. This draft can be found under + the [GitHub releases](https://github.com/nginxinc/nginx-gateway-fabric/releases) after the release branch is + created. 9. Create and push the release tag in the format `vX.Y.Z`. As a result, the CI/CD pipeline will: - - Build NGF, NGINX and NGINX Plus container images with the release tag `X.Y.Z` and push them to the registries. - - Package and publish the Helm chart to the registry. - - Create a GitHub release with an autogenerated changelog and attached release artifacts. + - Build NGF, NGINX and NGINX Plus container images with the release tag `X.Y.Z` and push them to the registries. + - Package and publish the Helm chart to the registry. + - Create a GitHub release with an autogenerated changelog and attached release artifacts. 10. Prepare and merge a PR into the main branch to update the [README](/README.md) to include the information about the latest release and also the [changelog](/CHANGELOG.md). Also update any installation instructions to ensure that the supported Gateway API and NGF versions are correct. Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`. @@ -70,9 +61,9 @@ To create a new release, follow these steps: 15. Submit the `conformance-profile.yaml` artifact from the release to the [Gateway API repo](https://github.com/kubernetes-sigs/gateway-api/tree/main/conformance/reports). - Create a fork of the repository - Name the file `nginxinc-nginx-gateway-fabric.yaml` and set `gatewayAPIVersion` in the file to the - supported version by NGF. Also update the site source if necessary (see following example). + supported version by NGF. Also update the site source if necessary (see following example). - Open a PR. [Example](https://github.com/kubernetes-sigs/gateway-api/pull/2514) - If it's your first time submitting a PR, you will need to sign a CLA using F5, Inc. as the organization. + If it's your first time submitting a PR, you will need to sign a CLA using F5, Inc. as the organization. ### Patch Release @@ -83,8 +74,8 @@ To create a new release, follow these steps: 1. Create an issue to define and track release-related activities. Choose a title that follows the format `Release X.Y.Z`. 2. If the fix applies to both the latest release and the main branch, then: - 1. Prepare and merge a fix PR into the in the main branch. - 2. Prepare and merge a fix PR (with a cherry-pick commit) into the existing release branch. + 1. Prepare and merge a fix PR into the in the main branch. + 2. Prepare and merge a fix PR (with a cherry-pick commit) into the existing release branch. 3. Alternatively, if the fix only applies to the latest release, prepare and merge a fix PR into the existing release branch. 4. Test the release branch for release-readiness. From 3d867bd13c86298a379651fa6d619db419620ff7 Mon Sep 17 00:00:00 2001 From: Luca Comellini Date: Wed, 20 Mar 2024 14:25:24 -0700 Subject: [PATCH 5/5] revert to edge --- .github/workflows/release-pr.yml | 3 ++- deploy/helm-chart/Chart.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index d8e5e2b0fe..498b8cd383 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -31,7 +31,8 @@ jobs: - name: Vars id: vars run: | - echo "current_version=$(yq '.appVersion' > $GITHUB_OUTPUT + # TODO(lucacome): improve this and maybe use appVersion instead of version if we switch to tags + echo "current_version=$(yq '.version' > $GITHUB_OUTPUT - name: Find and Replace uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2 diff --git a/deploy/helm-chart/Chart.yaml b/deploy/helm-chart/Chart.yaml index c64c15848c..7285ae509c 100644 --- a/deploy/helm-chart/Chart.yaml +++ b/deploy/helm-chart/Chart.yaml @@ -3,7 +3,7 @@ name: nginx-gateway-fabric description: NGINX Gateway Fabric type: application version: 1.1.0 -appVersion: "1.1.0" +appVersion: "edge" home: https://github.com/nginxinc/nginx-gateway-fabric icon: https://raw.githubusercontent.com/nginxinc/nginx-gateway-fabric/main/deploy/helm-chart/chart-icon.png sources: