-
Notifications
You must be signed in to change notification settings - Fork 137
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
Make release idempotent (+dry-run) #1492
Make release idempotent (+dry-run) #1492
Conversation
a97feb7
to
da26c7f
Compare
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.
All in all a good PR, I'm a bit confused by a few things in the release.yml and they should probably get sorted before merge 🤔
test-packages/release/src/publish.ts
Outdated
@@ -12,6 +13,14 @@ function tagFor(pkgName: string, entry: { newVersion: string }): string { | |||
return `v${entry.newVersion}-${pkgName.replace(/^@embroider\//, '')}`; | |||
} | |||
|
|||
function info(message: string) { | |||
process.stdout.write(`\n ℹ️ ${message}`); |
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.
why are we explicitly using process.stdout.write
when in other places in this same PR we're relying on the console
functions?
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.
pre-existing choice, idk
@@ -104,9 +195,10 @@ To publish a release you should start from a clean repo. Run "embroider-release | |||
let { solution, description } = loadSolution(); | |||
|
|||
if (!process.env.GITHUB_AUTH) { | |||
process.stderr.write(`You need to set GITHUB_AUTH.`); | |||
process.stderr.write(`\nYou need to set GITHUB_AUTH.`); |
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.
also why are we prefixing everything with \n
instead of just making sure that everything ends with an \n
?
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 that it stands out -- error messages are important, and we aren't giving them any color or anything, so they need another means of standing out.
Open questions from the call:
|
It seems like this workflow is intended to run on every push to main, and use relying on the script being idempotent if stuff has already been published? It does seem problematic to release whatever happens to be on master, especially given that:
In other places where we (I?) have set up automated publishing, we generally accomplish it by
Specifically, one way that I typically set this up is:
Since the publish workflow only runs on tag pushes and is tied to the SHA that the tag is for (inherently, you'd have to go out of the way to checkout a different SHA on GitHub Actions), it will never "publish the wrong things". In this case, I can appreciate that tagging may not be the best "trigger" because it's a monorepo, etc, but I don't see why you would need to forgo the general concept here and have the script run on main on every push, which does indeed have the problems you described. Some alternative triggers that would work:
In any case I think the issue is that the workflow runs too often/too willy-nilly, whereas you probably want it to be a lot more deliberate IMO. Separately to the issue you brought up, there is also another related race condition of using a PR-based workflow for releasing (as opposed to a direct
So I think using a PR workflow for releasing is generally a bit problematic for this reason (as compared to "push the tag"). You are adding an extra layer of review, but at the cost of introducing the race condition and it's unclear what the reviewers are really reviewing/approving. You could probably enforce this socially by asking people to hold off on merging things on discord, which perhaps works good enough. The more correct solution probably requires margin a |
18296af
to
3c5e37c
Compare
I just removed the publish.yml, as I don't want how we publish to block the work here of
these are still useful things to have for local publishing. @chancancode I understand your concerns, but the goal here is to remove the manual work of traditional releases (tagging, etc). But, my take on some things you've mentioned:
tests pass before merge -- which is usually sufficient -- once we enable the merge queue (which I don't think we've talked about yet, as a team), it would eliminate all potential risk with double-running the tests before a release. The issue now is what the merge queue would solve, multiple PRs from different points in history can be added to the head of main, but they haven't been tested with each other yet -- so running the release here (without the aforementioned sha check) is quite risky!
yeah! that's the
exactly, we have a tag per-package per-version.
This'll be for the next (or oxt) PR, (where I bring back the workflow), but given:
The risk of anything going wrong is quite low.
seems like extra work / process (more manual / prone to human error stuff)
we can forgoe the sha by having the sha in the
On most of my projects, I have Changesets running in the same manor, and it's no issue.
providing the sha-to-checkout in the
tag pushing is not viable, but everything you've suggested is at least double the amount of manual review / approving. 🙃 I really do appreciate the time you took to write out all these concerns though. Thank you!!! |
hm, it seems like you main takeaway was that I think we need to increase the amount of manual steps, or increase the places where things would go wrong, but I don't think that's quite what I am saying, and in fact the same core goals are definitely shared. anyway, happy to chat about this more elsewhere if that would be helpful, but it sounds like you already have concrete ideas for solving the problems you are facing, so all is good |
Apologies for misunderstanding. We can chat when i'm ready to create the workflow that will run the automation! |
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.
LGTM 💪
3c5e37c
to
1d64986
Compare
I removed the workflow that does the automated release, because we need a couple things first:
.release-plan.json
needs to have a sha in it, so we can check out the copy of the code that should contain the code-to-be-releasedmain
gets far-ahead of whatever is to be released, but all we need to do is update the release-planThis idempotency will allow us to run the release command on main without worry of errors or anything like that.
Blockers (these are all dealt with now)
Sample output:
There are 4 steps to release:
--dry-run
flag so I could see (via logs) that either something{con,de}structive
would happen, or if it'd be skipped via the idempotency checks