nodejs / node-core-utils

CLI tools for Node.js Core collaborators
https://nodejs.github.io/node-core-utils/
MIT License
234 stars 106 forks source link

git-node: add release promotion step #402

Open codebytere opened 4 years ago

codebytere commented 4 years ago

Refs https://github.com/nodejs/node-core-utils/pull/388.

Some of this hard to test, since it involved taking real steps that we take during releases.

I've chosen to seek active confirmation more here than in the prep stage, since many of the steps are irreversible, but I'm open to any and all thoughts about how much we might want.

This adds the secondary portion of release automation, for the promotion step. Specifically, we want to: 1) Verify that the release PR has green CI and an approval 2) Create and sign the release tag 3) Set up for next release 4) Merge the release proposal branch into the release branch 5) Cherry pick release commit to master 6) Push release tag 7) Promote and sign the release builds

cc @nodejs/releasers

codecov[bot] commented 4 years ago

Codecov Report

Merging #402 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #402   +/-   ##
=======================================
  Coverage   76.34%   76.34%           
=======================================
  Files          21       21           
  Lines        1484     1484           
=======================================
  Hits         1133     1133           
  Misses        351      351           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f58051c...3377b44. Read the comment docs.

targos commented 4 years ago

I'll review and try this when I do the 13.x release next week

targos commented 4 years ago

I'm trying git-node release --prepare but it runs out of memory while "Updating CHANGELOG_V13.md".

targos commented 4 years ago

Is it supposed to ask me for my GitHub credentials? It blocks immediately at:

$ /home/mzasso/git/nodejs/node-core-utils/bin/git-node release --promote 32813 
⠋ Verifying Releaser statusIf this is your first time running this command, follow the instructions to create an access token. If you prefer to create it yourself on Github, see https://github.com/nodejs/node-core-utils/blob/master/README.md.
⠸ Verifying Releaser status
targos commented 4 years ago

Okay, I found that I can enter my username/password/otp code and it continues. Then:

⠴ Verifying Releaser status
✔  Received member information of nodejs/releasers
✔  undefined is not a Releaser; aborting release
targos commented 4 years ago

The output of the next steps is weird:

✔  Done loading data for nodejs/node/pull/32813
... skipped some lines
   ✔  Approvals: 6
   ✔  - Matteo Collina (@mcollina) (TSC): https://github.com/nodejs/node/pull/32813#pullrequestreview-393019854
   ✔  - Colin Ihrig (@cjihrig) (TSC): https://github.com/nodejs/node/pull/32813#pullrequestreview-393040785
   ✔  - Richard Lau (@richardlau): https://github.com/nodejs/node/pull/32813#pullrequestreview-393075642
   ✔  - Shelley Vohr (@codebytere) (TSC): https://github.com/nodejs/node/pull/32813#pullrequestreview-393107238
   ✔  - Jiawen Geng (@gengjiawen): https://github.com/nodejs/node/pull/32813#pullrequestreview-393109215
   ✔  - Matheus Marchini (@mmarchini) (TSC): https://github.com/nodejs/node/pull/32813#pullrequestreview-393134711
   ✖  This PR needs to wait 19 more hours to land
✖  Jenkins CI is failing for #32813
--------------------------------------------------------------------------------
? Do you want to proceed? Yes
✔  Jenkins CI is passing
✖  GitHub CI is failing for #32813
--------------------------------------------------------------------------------
? Do you want to proceed? Yes
✔  GitHub CI is passing
✖  #32813 does not have sufficient approvals
--------------------------------------------------------------------------------
? Do you want to proceed? Yes
✔  #32813 has necessary approvals
targos commented 4 years ago

Then it crashes on the secure tag step:

? Tag and sign the release? Yes
Error: /home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:83
    throw new Error(`Unexpected reply for ${object}`);
    ^

Error: Unexpected reply for 
    at Batch.getEntry (/home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:83:11)
    at Batch.onMissing (/home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:89:22)
    at Batch.onHeader (/home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:73:10)
    at Batch.onData (/home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:56:12)
    at Socket.<anonymous> (/home/mzasso/git/nodejs/node-core-utils/node_modules/git-secure-tag/lib/git-secure-tag/batch.js:17:44)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at Socket.Readable.push (_stream_readable.js:214:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)

    at exports.runSync (/home/mzasso/git/nodejs/node-core-utils/lib/run.js:60:11)
    at ReleasePromotion.secureTagRelease (/home/mzasso/git/nodejs/node-core-utils/lib/promote_release.js:246:12)
    at ReleasePromotion.promote (/home/mzasso/git/nodejs/node-core-utils/lib/promote_release.js:85:10)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
codebytere commented 4 years ago

hmm @targos - it pulls information from your local ncu configuration 🤔 i have the normal setup for myself and it finds that i'm codebytere successfully.

In re. the second issue - looks like cli doesn't handle nested spinners very well, i'll refactor.

And re. secure-tag - i added it to deps but we might need to simply require that a releaser has globally installed it instead and then execute it that way. What do you think?

targos commented 4 years ago

@codebytere yeah, I actually did not have my .ncurc (it doesn't work well with the npm-check-updates lib and I have to move the file when I use it). I put it back in my home directory and it worked

targos commented 4 years ago

I wonder why it said that the PR does not have sufficient approvals. It has 6 of them 🤔

targos commented 4 years ago

This is what is passed to runSync for the secure tag:

/home/mzasso/git/nodejs/node-core-utils/node_modules/.bin/git-secure-tag [
  'v13.13.0',
  '813052119e9b73411534e2c50b027781e8882e10\n',
  '-sm',
  `"'2020-04-14, Node.js v13.13.0 (Current) Release"`
]
targos commented 4 years ago

The branch switching doesn't work:

? Merge proposal branch into staging branch? Yes
⠋ Merging proposal branchError: Switched to branch 'v13.x'

    at exports.runSync (/home/mzasso/git/nodejs/node-core-utils/lib/run.js:60:11)
    at ReleasePromotion.mergeProposalBranch (/home/mzasso/git/nodejs/node-core-utils/lib/promote_release.js:292:5)
    at ReleasePromotion.promote (/home/mzasso/git/nodejs/node-core-utils/lib/promote_release.js:101:16)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
targos commented 4 years ago

^

That's because runSync throws child.stderr as an error if it's not empty. But git sometimes outputs its messages to stderr. What should we do here?

targos commented 4 years ago

The promotion step doesn't work. It stops immediately with a success message, but the promotion did not happen (note that the promotion script is interactive so we may have to run it in a special way)

targos commented 4 years ago

@codebytere sorry for the spam. I wrote here as I was experiencing it, didn't want to forget anything 😄 . There are some things to fix, but I like it!

codebytere commented 4 years ago

thanks @targos - this stuff is hard to test except in action so i actually welcome the spam 😛

I'll check into this and figure out how we might better approach the actual promotion step 🤔

codebytere commented 4 years ago

@targos this should be in a bit better shape now - i may also swap some more things to run asynchronously and need to figure out a better way to handle https://github.com/nodejs/node-core-utils/pull/402#issuecomment-613596803 🤔 do you or perhaps @joyeecheung have some thoughts on best tactic to handle the stderr issue?

joyeecheung commented 4 years ago

hm, I don't exactly remember why runSync throws on non-empty stderr, but I think we can switch the condition to if (child.status !== 0). If anything comes back weird we could switch it back and add an option like options.expectEmptyStderr for that particular use case.

codebytere commented 3 years ago

@targos rebased and updated a few things if you're willing to give this another spin on your next release!

targos commented 3 years ago

I'm giving it a try now with 12.17.0

github-actions[bot] commented 3 years ago

This PR is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

github-actions[bot] commented 3 years ago

This PR is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.