Skip to content

Commit

Permalink
Create Release PR workflow (#1732)
Browse files Browse the repository at this point in the history
Problem: Manually updating the old tag is boring and error prone

Solution: Automate the process and automatically open a PR for the
release
  • Loading branch information
lucacome authored and salonichf5 committed Mar 20, 2024
1 parent 8ac5ff5 commit e979c0a
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 31 deletions.
36 changes: 36 additions & 0 deletions .github/CHANGELOG_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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%%`
- Data plane with NGINX Plus: `private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:%%VERSION%%`
3 changes: 1 addition & 2 deletions .github/workflows/nfr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <[email protected]>
committer: nginx-bot <[email protected]>
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)' || ''}}
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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: |
# TODO(lucacome): improve this and maybe use appVersion instead of version if we switch to tags
echo "current_version=$(yq '.version' <deploy/helm-chart/Chart.yaml)" >> $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: 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
sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" 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
- 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 <[email protected]>
committer: nginx-bot <[email protected]>
body: |
This automated PR updates all the necessary files for ${{ inputs.version }} release.
49 changes: 20 additions & 29 deletions docs/developer/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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

Expand All @@ -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.
Expand Down

0 comments on commit e979c0a

Please sign in to comment.