-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Fix NewDot deploys #9771
Conversation
@@ -117,7 +117,7 @@ success "Version bumped to $(print_version) on main" | |||
info "Merging main into staging..." | |||
git checkout staging | |||
git checkout -b update-staging-from-main | |||
git merge --no-edit -Xtheirs main | |||
git merge --no-edit -Xtheirs main || git diff --name-only --diff-filter=U | xargs git rm && git merge --continue |
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.
can you explain the functionality of the double and single pipe here?
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.
So this has been replaced by the following:
git merge -Xtheirs main || {
git diff --name-only --diff-filter=U | xargs git rm;
git merge --continue;
}
Breaking that down:
- First we try to execute
git merge -Xtheirs main
- If that fails, the
||
will ensure that the next statement will run. If it succeeds, the next statement will not run. - The next statement is a command group – everything inside the
{}
is treated as a single command in the same shell.git diff --name-only --diff-filter=U
will list the names of unmerged files in the ongoinggit merge
- We pipe those unmerged files into
git rm
usingxargs
. Basically the output of thegit diff
command becomes the argument forgit rm
. In effect, we're runninggit rm
on all the unmerged files. - Lastly, we'll continue with the git merge.
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.
Code LGTM, tests are failing though
Okay, going to merge so we can test and hopefully deploy NewDot. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @roryabraham in version: 1.1.81-0 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.82-5 🚀
|
Details
Interestingly, there were two separate issues, one that caused the production deploy to fail, and another that caused the staging deploy to fail.
Production
First, the production deploy failed with this error:
error: pathspec 'staging' did not match any file(s) known to git
This happened because this comment wasn't entirely accurate. While we're guaranteed to have a branch, we're not guaranteed to have all the branches we need. To fix that is simple – just run a
git fetch
from within the action. That way we'll have all the branches from the remote.Staging
Second, the staging deploy failed because this command:
git merge -Xtheirs main
failed with this error:I believe it's only by luck/coincidence that this hasn't happened before. Normally we do the following, with the intention of completely overwriting the
staging
branch withmain
:The key piece here is the
-Xtheirs
flag, which basically says "if there's a conflict, use the version of the code frommain
". However, that doesn't work in the specific scenario where a file was modified onstaging
and deleted onmain
. Because we want to prioritize the changes from main, we'll automatically resolve the conflicts using the change from main, using the following command:And what this says is basically:
This is safe, because the inverse scenario (a file is edited on main but deleted on staging) is not possible because all changes propagate from
main
->staging
->production
.Fixed Issues
$ n/a – broken deploys.
Local Test
Go to the App repo locally and run these commands:
It will most likely open a pager for the commit message (but that won't happen in the GH Actions runner by default), but otherwise the commit should succeed.
Live Test