Skip to content

Commit

Permalink
fix(buildtool): Push changelog command should pull origin (#49) (#50)
Browse files Browse the repository at this point in the history
I was trying to figure out why any manual changes I made to the raw
changelog (notably deleting the no-longer-needed 1.14, 1.15, 1.16
entries) were disappearing.  It turns out that while we fetch the
origin commit, we don't do anything with it, and commit on top of
what's currently on the jenkins machine, then force push that to
the origin.

Instead, just reset master to origin/master before making any
changes. There should not be any local changes in this directory;
if there are, it would be from an error in some prior run, and we'd
rather just start fresh (as we do in the first block where we just
clone).

Also remove the force push; if the origin *has* changed since we
fetched a few lines above, let's fail rather than overwrite what's
there.

Co-authored-by: Eric Zimanyi <ezimanyi@google.com>
  • Loading branch information
spinnakerbot and ezimanyi authored Mar 19, 2020
1 parent 10147e7 commit 1d8cc52
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dev/buildtool/changelog_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def _do_command(self):
logging.debug('Updating gist in "%s"', git_dir)
self.git_run_with_retries(git_dir, 'fetch origin master')
self.git_run_with_retries(git_dir, 'checkout master')
self.git_run_with_retries(git_dir, 'reset --hard origin/master')

dest_path = os.path.join(
git_dir, '%s-raw-changelog.md' % options.git_branch)
Expand All @@ -550,7 +551,7 @@ def _do_command(self):
git_dir, '-a -m "Updated %s"' % os.path.basename(dest_path))

logging.debug('Pushing back gist')
self.git_run_with_retries(git_dir, 'push -f origin master')
self.git_run_with_retries(git_dir, 'push origin master')


# For some reason gist.github.com seems to have a lot of connection timeout
Expand Down

0 comments on commit 1d8cc52

Please sign in to comment.