Skip to content

[No QA] Use force-push to update staging and production#10378

Merged
roryabraham merged 1 commit into
mainfrom
Rory-OSBotifyForcePush
Aug 15, 2022
Merged

[No QA] Use force-push to update staging and production#10378
roryabraham merged 1 commit into
mainfrom
Rory-OSBotifyForcePush

Conversation

@roryabraham

Copy link
Copy Markdown
Contributor

Details

Slack context: https://expensify.slack.com/archives/C07J32337/p1660240289078479

This PR utilizes OSBotify's new ability to bypass branch protection permissions that require pull requests to push changes and prohibit force-pushing to a protected branch. Furthermore, when updating staging, we'll just delete the staging branch and re-create it from main. When updating production, we'll just delete the production branch and re-create it from staging. This eliminates the possibility of conflicts, simplifies deploy workflows, and also fixes #10214

I believe there's more we could do to clean things up (including using the same strategy to update main, but for now this PR is focused on unblocking deploys.

Fixed Issues

$ #10214

Tests

Merge this PR with the CP staging label. Verify that the staging build is fixed and that staging deploys successfully.

@roryabraham roryabraham requested a review from a team as a code owner August 15, 2022 16:42
@roryabraham roryabraham self-assigned this Aug 15, 2022
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ ⚠️ Heads up! This pull request has the CP Staging label. ⚠️ ⚠️
Merging it will cause it to be immediately deployed to staging, even if the open StagingDeployCash deploy checklist is locked.

@melvin-bot melvin-bot Bot requested review from danieldoglas and removed request for a team August 15, 2022 16:42
if: ${{ inputs.TARGET_BRANCH != 'main' }}
shell: bash
run: |
git checkout ${{ env.SOURCE_BRANCH }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to also verify that SOURCE_BRANCH is either main or staging first? Based on line 47, it could be something else too (though I don't understand why)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So the Set source branch step sets the source branch in the environment like so:

  1. If the target branch is staging, the source branch is main
  2. If the target branch is production, the source branch is staging
  3. Else (the target branch is main), and the source branch is whatever is passed in inputs.TARGET_BRANCH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, so this is covered by the if: ${{ inputs.TARGET_BRANCH != 'main' }}. That's all I wanted to confirm, thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Overall this action maybe isn't as clear and clean as it could be because so much of it only applies for if the target branch is main, but cleanup is out-of-scope for now. I'll be working on a design doc soon to clean up a lot of our GitHub Actions code.

if: ${{ inputs.TARGET_BRANCH != 'main' }}
shell: bash
run: |
git checkout ${{ env.SOURCE_BRANCH }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, so this is covered by the if: ${{ inputs.TARGET_BRANCH != 'main' }}. That's all I wanted to confirm, thanks.

@roryabraham roryabraham merged commit c2e99f2 into main Aug 15, 2022
@roryabraham roryabraham deleted the Rory-OSBotifyForcePush branch August 15, 2022 17:26
OSBotify pushed a commit that referenced this pull request Aug 15, 2022
OSBotify added a commit that referenced this pull request Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate why some changes didn't make it to staging as expected

2 participants