Auto: Abort release if new commits detected upstream

Created on 30 Jul 2020  ·  13Comments  ·  Source: intuit/auto

Is your feature request related to a problem? Please describe.

When running auto shipit from master which is not at the same commit of the remote an error will occur when the version bump and changelog commits are pushed.

Describe the solution you'd like

Detect the issue prior to git and give an instructive error.

Describe alternatives you've considered

Checkout the local baseBranch and git pull from remote.

bug

All 13 comments

@jrschumacher I recreated the issue without the screenshot of the leaked token. Forgot what the title was though

🤦‍♂️ thanks it's been a long day. If you point me to the right file I'll investigate adding the check and error. I looked in core but didn't see where the push was happening.

Is this repo public? I can poke around.

Where are the logs for this. Currently we do have code that will abort the release if we detect this situation

https://github.com/intuit/auto/blob/d419b17f46638ebee68d125467891ac2e1d25304/packages/core/src/auto.ts#L402-L438

docs for the ls-remote command: https://riptutorial.com/git/example/1486/ls-remote

So the only way I could see this happening is if you merged 2 PRs at the exact right time.

The hook order goes like:

  • changelog
  • version
  • afterVersion <- ls-remote check here
  • merge?
  • publish <- tags pushed here

Let me see if I can create a repeatable scenario and provide logs.

I see what's happening. You use prepublishOnly which will lengthen the window between afterVersion and publish if the command it runs is long.

  • 1st merged PR is building and on publish step
  • 2nd merged PR gets to publish while the 1st PR is just finishing

My recommendation would be to run your build then run auto (remove the prepublishOnly script)

I will update this doc and warn about this type of situation.

Gotcha. So if I move it to prerelease that should solve it?

yup that would work too!

Thanks so much for this great tool and the support.

Thanks for using auto! (and for surfacing this issue https://github.com/intuit/auto/pull/1419)

I'm gonna close this issue. If you find this is still happening feel free open another issue.

Was this page helpful?
0 / 5 - 0 ratings