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

chore: Define check in release process ensuring migration guide is defined in a major version #2171

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,21 @@ jobs:
echo "runs_tests=$(if [ '${{ inputs.skip_tests }}' = 'true' ]; then echo 'false'; else echo 'true'; fi)"
} >> "$GITHUB_OUTPUT"

validate-version-input:
validate-inputs:
runs-on: ubuntu-latest
steps:
- name: Validation of version format
run: |
echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$'
- name: Checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
with:
ref: ${{ inputs.use_existing_tag == 'true' && inputs.version_number || 'master' }}
- name: Check for Upgrade Guide
run: './scripts/check-upgrade-guide-exists.sh ${{inputs.version_number}}'

update-examples-reference-in-docs:
needs: [ release-config, validate-version-input ]
needs: [ release-config, validate-inputs ]
Copy link
Member

Choose a reason for hiding this comment

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

knit: similary to validate-inputs i don't know if it would be better to have an update job with both references in doc and changelog header. or maybe it's better as it is now

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the commits are being done by calling an external workflow we do not have the possibility of having both in a single job

if: >-
!cancelled()
&& !contains(needs.*.result, 'failure')
Expand All @@ -58,7 +64,7 @@ jobs:
passphrase: ${{ secrets.APIX_BOT_PASSPHRASE }}

update-changelog-header:
needs: [ release-config, validate-version-input, update-examples-reference-in-docs ]
needs: [ release-config, validate-inputs, update-examples-reference-in-docs ]
if: >-
!cancelled()
&& !contains(needs.*.result, 'failure')
Expand All @@ -77,7 +83,7 @@ jobs:

create-tag:
runs-on: ubuntu-latest
needs: [ release-config, validate-version-input, update-examples-reference-in-docs, update-changelog-header ]
needs: [ release-config, validate-inputs, update-examples-reference-in-docs, update-changelog-header ]
if: >-
!cancelled()
&& !contains(needs.*.result, 'failure')
Expand All @@ -99,7 +105,7 @@ jobs:
gpg_passphrase: ${{ secrets.PASSPHRASE }}

run-qa-acceptance-tests:
needs: [ release-config, validate-version-input, update-examples-reference-in-docs, update-changelog-header, create-tag ]
needs: [ release-config, validate-inputs, update-examples-reference-in-docs, update-changelog-header, create-tag ]
if: >-
!cancelled()
&& !contains(needs.*.result, 'failure')
Expand All @@ -112,7 +118,7 @@ jobs:

release:
runs-on: ubuntu-latest
needs: [ validate-version-input, update-examples-reference-in-docs, update-changelog-header, create-tag, run-qa-acceptance-tests ]
needs: [ validate-inputs, update-examples-reference-in-docs, update-changelog-header, create-tag, run-qa-acceptance-tests ]
# Release is skipped if there are failures in previous steps
if: >-
!cancelled()
Expand Down
23 changes: 23 additions & 0 deletions scripts/check-upgrade-guide-exists.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail

: "${1?"Tag of new release must be provided"}"

RELEASE_TAG=$1
RELEASE_NUMBER=$(echo "${RELEASE_TAG}" | tr -d v)

IFS='.' read -r MAJOR MINOR PATCH <<< "$RELEASE_NUMBER"

# Check if it's a major release (patch version is 0)
if [ "$PATCH" -eq 0 ]; then
UPGRADE_GUIDE_PATH="website/docs/guides/$MAJOR.$MINOR.$PATCH-upgrade-guide.html.markdown"
echo "Checking for the presence of $UPGRADE_GUIDE_PATH"
if [ ! -f "$UPGRADE_GUIDE_PATH" ]; then
echo "Stopping release process, upgrade guide $UPGRADE_GUIDE_PATH does not exist. Please visit our releasing documentation for more details."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Preferred to keep it more generic so the reference does not breaking moving forward, but no strong opinion

Copy link
Collaborator

Choose a reason for hiding this comment

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

we could add a link to the RELEASE.md instead of the exact section

exit 1
else
echo "Upgrade guide $UPGRADE_GUIDE_PATH exists."
fi
else
echo "No upgrade guide needed."
fi