Commit 6fe33877 authored by machenbach's avatar machenbach Committed by Commit bot

[release] Let release script fix missing tags.

Check if a previous run left an inconsistent state behind.
The check is right before trying to push a new state as then
all information is available, like commit message and tag
name.

This is still only a band-aid. If gnumbd is down for a
longer period, an unprocessed commit won't be found, but
the push attempt will still fail.

Review URL: https://codereview.chromium.org/1887583002

Cr-Commit-Position: refs/heads/master@{#35437}
parent a021c6af
......@@ -223,6 +223,27 @@ class CommitBranch(Step):
os.remove(self.Config("CHANGELOG_ENTRY_FILE"))
class FixBrokenTag(Step):
MESSAGE = "Check for a missing tag and fix that instead."
def RunStep(self):
commit = None
try:
commit = self.GitLog(
n=1, format="%H",
grep=self["commit_title"],
branch="origin/%s" % self["version"],
)
except GitFailedException:
# In the normal case, the remote doesn't exist yet and git will fail.
pass
if commit:
print "Found %s. Trying to repair tag and bail out." % self["version"]
self.step.Git("tag %s %s" % (self["version"], commit))
self.step.Git("push origin %s" % self["version"])
return True
class PushBranch(Step):
MESSAGE = "Push changes."
......@@ -303,6 +324,7 @@ class CreateRelease(ScriptsBase):
SetVersion,
EnableMergeWatchlist,
CommitBranch,
FixBrokenTag,
PushBranch,
TagRevision,
CleanUp,
......
......@@ -970,6 +970,8 @@ Performance and stability improvements on all platforms."""
cb=self.WriteFakeWatchlistsFile),
Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
cb=CheckVersionCommit),
Cmd("git log -1 --format=%H --grep=\"Version 3.22.5\" origin/3.22.5",
""),
Cmd("git push origin "
"refs/heads/work-branch:refs/pending/heads/3.22.5 "
"push_hash:refs/pending-tags/heads/3.22.5 "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment