Skip to content

Force push when synchronizing submodules - #4426

Merged
GMNGeoffrey merged 4 commits into
iree-org:mainfrom
GMNGeoffrey:force-push-submodules
Jan 12, 2021
Merged

GMNGeoffrey merged 4 commits into
iree-org:mainfrom
GMNGeoffrey:force-push-submodules

Conversation

@GMNGeoffrey

@GMNGeoffrey GMNGeoffrey commented Jan 8, 2021 •

Copy link
Copy Markdown
Member

Instead of adding a new commit that fixes up the submodules, rewrite
the HEAD commit so that they are correct. This action was originally
intended for rare cases where Copybara messed up integrations. These
"rare cases" now happen multiple times a day and are cluttering the
repository history with useless commits. We have already decided it's
ok to rewrite the google branch history to fix up Copybara failures to
create merge commits, so this doesn't change things much. It also
us to expand this action to create those merge commits as well.

Somewhat incidentally, I noticed that this action doesn't actually need
to initialize the submodules themselves. It only really deals in
hashes, which are already recorded. Dropping this makes it ~10x faster.

This has a couple disadvantages:

  • If multiple commits are pushed and an intermediate one is the one
    that introduces a submodule diff, the changes will get erroneously
    attributed to the current HEAD commit. The rate of pushes to this
    branch is pretty low, so I don't think that will happen to
    frequently. I can work on some more complex logic that walks the
    history instead.
  • If someone is trying to track the google branch, rewriting history
    more frequently will make things difficult for them. This branch is
    only intended for the export from google source control, so the only
    people who should care about it are build cops and maybe googlers,
    and I think the inconvenience will be minor.
  • There will be some lag time between when a commit is exported and
    when it can be safely merged into the main branch. This action runs
    in about 10 seconds and quickly reports a failure (plus you can see
    the pending status as well), so I think this isn't likely to happen.

Tested:
Ran this on my fork. Initially pushed a cherry-picked version of
78170d0a58fe
screenshot.
The check action failed on this, marking it with an "x"
(https://github.com/GMNGeoffrey/iree/runs/1666244136) and the
synchronize action fixed it up
(https://github.com/GMNGeoffrey/iree/runs/1666187868)
with the final result being
GMNGeoffrey@ec9e72364088.

@google-cla google-cla Bot added the cla: yes label Jan 8, 2021
@GMNGeoffrey GMNGeoffrey changed the title force push submodules Force push when synchronizing submodules Jan 8, 2021
@GMNGeoffrey
GMNGeoffrey requested a review from ScottTodd January 8, 2021 02:21
@GMNGeoffrey
GMNGeoffrey merged commit 919fd71 into iree-org:main Jan 12, 2021
@GMNGeoffrey
GMNGeoffrey deleted the force-push-submodules branch January 12, 2021 02:02
@GMNGeoffrey GMNGeoffrey added the infrastructure Relating to build systems, CI, or testing label Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Relating to build systems, CI, or testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants