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

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

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

roryabraham
Copy link
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
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
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
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
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
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
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.

[HOLD for payment 2023-07-03] Investigate why some changes didn't make it to staging as expected
2 participants