-
Notifications
You must be signed in to change notification settings - Fork 227
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: update and fix rollback workflow #2551
Changes from all commits
89f0470
825bce3
fd426bf
e55b0a5
d4f1149
df1693b
7956e2e
2fee63f
66c723a
4da60a3
165e3fe
6dc2cee
d51c040
14e2365
21e9225
161ffd1
888cc63
59b1a9e
857802c
6c6e1d6
cfde461
b5f41f1
787a87e
741de5b
3f2f0f4
1f78c50
81266c4
3da7980
aab6a39
ff156ad
8869cb6
ab2adff
dee9ec2
f1bd079
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,51 +1,93 @@ | ||||||
name: Rollback release | ||||||
name: Rollback latest release | ||||||
|
||||||
on: | ||||||
workflow_dispatch: | ||||||
inputs: | ||||||
version-to-roll-back: | ||||||
description: version number that needs to be rolled back (format x.x.x) | ||||||
type: string | ||||||
rollbackChannel: | ||||||
description: Which channel needs to be rolled back? | ||||||
type: choice | ||||||
required: true | ||||||
options: | ||||||
- stable | ||||||
- beta | ||||||
- alpha | ||||||
|
||||||
jobs: | ||||||
determine-target-tag: | ||||||
name: Determine target tag for rollback | ||||||
get-target-and-rollback-tags: | ||||||
name: Get target tag and rollback tags | ||||||
runs-on: ubuntu-latest | ||||||
outputs: | ||||||
targetTag: ${{ github.ref_name }} | ||||||
isStableRelease: ${{ steps.isStableRelease.outputs.isStableRelease }} | ||||||
targetTag: ${{ steps.getRollbackTargetTags.outputs.targetTag }} | ||||||
rollbackTag: ${{ steps.getRollbackTargetTags.outputs.rollbackTag }} | ||||||
steps: | ||||||
- name: is input a tag | ||||||
if: github.ref_type != 'tag' | ||||||
run: exit 1 | ||||||
- name: Get target version | ||||||
id: isStableRelease | ||||||
shell: bash | ||||||
- name: install apt-get dependencies | ||||||
run: | | ||||||
if [[ ${{ github.ref_name }} =~"beta" ]] | ||||||
then | ||||||
echo "isStableRelease=true" >> $GITHUB_OUTPUT | ||||||
sudo apt-get update | ||||||
sudo apt-get install -y awscli jq | ||||||
- name: get rollback and target tags | ||||||
id: getRollbackTargetTags | ||||||
run: | | ||||||
VERSION_LIST=$(npm view heroku versions --json) | ||||||
CHANNEL_VERSION_LIST=[] | ||||||
if [[ ${{ inputs.rollbackChannel }} == 'stable' ]]; then | ||||||
CHANNEL_VERSION_LIST=$(echo ${VERSION_LIST} | jq '[.[] | select(test("-") | not )]') | ||||||
else | ||||||
echo "isStableRelease=false" >> $GITHUB_OUTPUT | ||||||
CHANNEL_VERSION_LIST=$(echo ${VERSION_LIST} | jq '[.[] | select(test("'${{ inputs.rollbackChannel }}'"))]') | ||||||
fi | ||||||
ROLLBACK_VERSION=$(echo ${CHANNEL_VERSION_LIST} | jq '.[-1]') | ||||||
echo "rollbackTag=${ROLLBACK_VERSION}" >> $GITHUB_OUTPUT | ||||||
TARGET_VERSION=$(echo ${CHANNEL_VERSION_LIST} | jq '.[-2]') | ||||||
echo "targetTag=${TARGET_VERSION}" >> $GITHUB_OUTPUT | ||||||
|
||||||
promote-previous-tag: | ||||||
needs: determine-target-tag | ||||||
name: Promote ${{ needs.determine-target-tag.outputs.targetTag }} to ${{ needs.determine-target-tag.outputs.isStableRelease && 'stable' || 'beta' }} | ||||||
validate-stable-tags: | ||||||
name: Validate rollback tag | ||||||
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ | ||||||
runs-on: pub-hk-ubuntu-22.04-small | ||||||
needs: [get-target-and-rollback-tags] | ||||||
env: | ||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
steps: | ||||||
- if: ${{ inputs.rollbackChannel == 'stable' }} | ||||||
run: | | ||||||
GITHUB_LATEST_RELEASE=$(gh release view --repo heroku/cli --json tagName -q '.tagName.[1:]') | ||||||
if [[ "${GITHUB_LATEST_RELEASE}" != "'${{ needs.get-target-and-rollback-tags.outputs.rollbackTag }}'"* ]]; then | ||||||
echo "The Github latest release (${GITHUB_LATEST_RELEASE}) and the NPM latest release ("${{ needs.get-target-and-rollback-tags.outputs.rollbackTag }}") do not match." | ||||||
exit 1 | ||||||
fi | ||||||
|
||||||
# This job needs to go before the promote job, as the promote job looks for the current channel release on NPM. | ||||||
deprecate-npm-rollback-tag: | ||||||
needs: [get-target-and-rollback-tags, validate-stable-tags] | ||||||
name: Deprecate rollback version on NPM | ||||||
# if statement only here to protect our prod release while we test this functionality | ||||||
if: ${{ !fromJSON(needs.determine-target-tag.outputs.isStableRelease) }} | ||||||
if: ${{ inputs.rollbackChannel != 'stable' }} | ||||||
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ | ||||||
runs-on: pub-hk-ubuntu-22.04-small | ||||||
steps: | ||||||
- name: set NPM auth | ||||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_KEY }}" > ~/.npmrc | ||||||
- name: deprecate NPM release and set previous release to latest/prerelease channel | ||||||
run: | | ||||||
npm dist-tag add heroku@${{ needs.get-target-and-rollback-tags.outputs.targetTag }} ${{ inputs.rollbackChannel }} | ||||||
npm deprecate heroku@${{ needs.get-target-and-rollback-tags.outputs.rollbackTag }} "Version is deprecated due to problems with the release" | ||||||
|
||||||
promote-target-tag: | ||||||
needs: [get-target-and-rollback-tags, validate-stable-tags, deprecate-npm-rollback-tag] | ||||||
name: Promote ${{ needs.get-target-and-rollback-tags.outputs.targetTag }} to ${{ inputs.rollbackChannel }} | ||||||
# if statement only here to protect our prod release while we test this functionality | ||||||
if: ${{ inputs.rollbackChannel != 'stable' }} | ||||||
uses: ./.github/workflows/promote.yml | ||||||
with: | ||||||
version: ${{ needs.determine-target-tag.outputs.targetTag }} | ||||||
isStableRelease: ${{ needs.determine-target-tag.outputs.isStableRelease }} | ||||||
version: ${{ needs.get-target-and-rollback-tags.outputs.targetTag }} | ||||||
isStableRelease: ${{ inputs.rollbackChannel == 'stable' }} | ||||||
channel: ${{ inputs.rollbackChannel }} | ||||||
secrets: inherit | ||||||
|
||||||
invalidate-cdn-cache: | ||||||
needs: [determine-target-tag, promote-previous-tag] | ||||||
needs: [get-target-and-rollback-tags, validate-stable-tags, promote-target-tag] | ||||||
name: Invalidate Cloudfront cache | ||||||
# if statement only here to protect our prod release while we test this functionality | ||||||
if: ${{ !fromJSON(needs.determine-target-tag.outputs.isStableRelease) }} | ||||||
if: ${{ inputs.rollbackChannel != 'stable' }} | ||||||
runs-on: ubuntu-latest | ||||||
env: | ||||||
CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }} | ||||||
|
@@ -60,32 +102,17 @@ jobs: | |||||
aws configure set preview.cloudfront true | ||||||
- run: ./scripts/postrelease/invalidate_cdn_cache | ||||||
|
||||||
deprecate-npm-version: | ||||||
needs: determine-target-tag | ||||||
name: Deprecate rollback version on NPM | ||||||
# if statement only here to protect our prod release while we test this functionality | ||||||
if: ${{ !fromJSON(needs.determine-target-tag.outputs.isStableRelease) }} | ||||||
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ | ||||||
runs-on: pub-hk-ubuntu-22.04-small | ||||||
steps: | ||||||
- name: set NPM auth | ||||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_KEY }}" > ~/.npmrc | ||||||
- name: deprecate release | ||||||
run: | | ||||||
npm dist-tag add heroku@${{ needs.determine-target-tag.outputs.targetTag }} ${{ needs.determine-target-tag.outputs.isStableRelease && 'latest' || 'beta' }} | ||||||
npm deprecate heroku@${{ inputs.version-to-roll-back }} "Version is deprecated due to problems with the release" | ||||||
|
||||||
rollback-brew: | ||||||
name: Rollback brew release | ||||||
needs: determine-target-tag | ||||||
if: ${{ !fromJSON(needs.determine-target-tag.outputs.isStableRelease) }} | ||||||
needs: [get-target-and-rollback-tags, validate-stable-tags] | ||||||
if: ${{ inputs.rollbackChannel != 'stable' }} | ||||||
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this.
Suggested change
There will be nothing to rollback in our brew repo unless it was a stable release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only there for testing, to make sure we don't actually roll back a stable release. I'll remove this check after the test. |
||||||
runs-on: pub-hk-ubuntu-22.04-small | ||||||
environment: ReleaseHomebrew | ||||||
steps: | ||||||
- name: yarn install | ||||||
run: yarn --immutable --network-timeout 1000000 | ||||||
- name: rollback homebrew | ||||||
run: node ./scripts/rollback/homebrew.js | ||||||
run: ./scripts/rollback/homebrew.js | ||||||
env: | ||||||
ROLLBACK_VERSION: ${{ inputs.version-to-roll-back }} | ||||||
ROLLBACK_VERSION: ${{ needs.get-target-and-rollback-tags.outputs.rollbackTag }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final sanity check: how worried are we that we can not specify the version to rollback to?