Skip to content
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

build: implement a Commit Queue in Actions #34112

Closed
wants to merge 2 commits into from

Conversation

mmarchini
Copy link
Contributor

@mmarchini mmarchini commented Jun 29, 2020

This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses node-core-utils to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
node-core-utils output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201


I've been testing this feature on https://github.com/mmarchini-oss/automated-merge-test and it works well for most general cases. If anyone wants to give it a try, let me know so I can add you to the repository.

Here's an example of the Action landing a Pull Request:

image
(mmarchini-oss/automated-merge-test#17)

And here's an example of the comment left by the Action when a PR fails to land:

image
(mmarchini-oss/automated-merge-test#54 (comment))

Requirements to land

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@mmarchini mmarchini added the blocked PRs that are blocked by other issues or PRs. label Jun 29, 2020
@nodejs-github-bot nodejs-github-bot added meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory. labels Jun 29, 2020
tools/actions/commit-queue.sh Show resolved Hide resolved
tools/actions/commit-queue.sh Show resolved Hide resolved
doc/guides/commit-queue.md Outdated Show resolved Hide resolved
doc/guides/commit-queue.md Show resolved Hide resolved
tools/actions/commit-queue.sh Outdated Show resolved Hide resolved
tools/actions/commit-queue.sh Outdated Show resolved Hide resolved
tools/actions/commit-queue.sh Show resolved Hide resolved
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on this thankless, unglamorous job, Matheus.

.github/workflows/commit-queue.yml Outdated Show resolved Hide resolved
.github/workflows/commit-queue.yml Show resolved Hide resolved
.github/workflows/commit-queue.yml Outdated Show resolved Hide resolved
doc/guides/commit-queue.md Outdated Show resolved Hide resolved
doc/guides/commit-queue.md Outdated Show resolved Hide resolved
doc/guides/commit-queue.md Outdated Show resolved Hide resolved
Copy link
Member

@lundibundi lundibundi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after fixing the md.

@mmarchini
Copy link
Contributor Author

LGTM after fixing the md

I thought I addressed all comments yesterday. Did I miss something?

@lundibundi
Copy link
Member

@mmarchini PTAL at github-actions warnings of doc/guides/commit-queue.md, or just run lint-md locally. IIRC there should be an empty line in order to make nested lists in md. Currently, all sub-elements are concatenated in one line which is visible in GitHub md preview.

@mmarchini
Copy link
Contributor Author

I plan to land this late next week (probably next Friday). Want to wait a little more to see if we learn anything else from the request-ci PR. I'll also update this PR with what we learned so far (make sure this don't run on forks otherwise it'll be a flood of notifications, and make sure we have comprehensive log in case things don't work).

@mmarchini
Copy link
Contributor Author

Might as well land it tomorrow since we might change how the Jenkins starter works (#34707). I still think schedule event is the appropriate one for a commit queue though, if we use pull_request_target and two actions run simultaneously the second one to finish will fail to push. We could implement a wait mechanism so that one action executes at a time, it would be a matter of choosing which complexity we want in the repo.

I'll update the docs in this PR to replace mentions of "pull_request event won't work" with "if we use pull_request_target and two actions run simultaneously the second one to finish will fail to push".

This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201
@devsnek
Copy link
Member

devsnek commented Aug 10, 2020

Does this validate that the cq label was added by someone with commit permissions?

@mmarchini
Copy link
Contributor Author

It works under the assumption that only folks with commit permission can add labels, which was true until a month or so ago when we introduced the triaging team :/

Nice catch, will update with this check.

@addaleax
Copy link
Member

I actually think it would be helpful if triagers could kick off CQ, it’s just that their reviews shouldn’t count towards the PR being ready, right?

@mmarchini

This comment has been minimized.

.github/workflows/commit-queue.yml Outdated Show resolved Hide resolved
Co-authored-by: Anna Henningsen <github@addaleax.net>
@mcollina
Copy link
Member

wow!

Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome, i'm really excited to see where this goes 🥳

@bnb
Copy link
Contributor

bnb commented Aug 11, 2020

this is super awesome @mmarchini. Incredible work, Mary.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looking forward to seeing this in action.

Comments are non-blocking.

1. The Pull Request must have only one commit
2. A CI must've ran and succeeded since the last change on the PR
3. A Collaborator must have approved the PR since the last change
4. Only Jenkins CI is checked (Actions, V8 CI and CITGM are ignored)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Actions are checked now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, I have a PR open for that

Comment on lines +38 to +39
# TODO(mmarchini): install from npm after next ncu release is out
npm install -g 'https://github.com/mmarchini/node-core-utils#commit-queue-branch'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a new version of node-core-utils published before landing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we get a new version before I land this I'll update here, otherwise I'll follow up with a PR to update it later

@mmarchini
Copy link
Contributor Author

should triagers be able to start Jenkins CI?

omg I just realized I made a huge mistake on my comment above. Triage team will be able to start Commit Queue, not CI (they already can start CI today :) ). So let me rephrase my question: should the triage team be allowed to start Commit Queue, which means they will be able to land pull requests? As @addaleax mentioned above, triage team will still not count towards reviews, and the Commit Queue runs all the necessary checks before landing (wait time, reviews, CI, etc). This might help offload some landing work from collaborators, which is good. OTOH it gives partial commit permission to a team separate from collaborators. So what do folks think?

@addaleax
Copy link
Member

@mmarchini I didn’t even notice :) To be clear, I’m very much +1 on both.

@mmarchini mmarchini removed the blocked PRs that are blocked by other issues or PRs. label Aug 14, 2020
mmarchini added a commit that referenced this pull request Aug 14, 2020
This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201

PR-URL: #34112
Refs: https://github.com/mmarchini-oss/automated-merge-test
Refs: nodejs/build#2201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@mmarchini
Copy link
Contributor Author

Landed in a84716a 🎉

@mmarchini mmarchini closed this Aug 14, 2020
@Trott
Copy link
Member

Trott commented Aug 14, 2020

Guess I'll find out when someone uses it, but when this action is used, who/what shows up on the Commit: line when you do something like git log --format=fuller? I'm asking because I use that as one of the metrics I collect on collaborators to see who is super active and who is not so much. (Maybe someone isn't writing much code but is landing a lot of commits and closing PRs.)

This is in no way opposition to this nor am I asking to be accommodated. Just curious what the change will look like. I am fully on Team Commit Queue.

@mmarchini
Copy link
Contributor Author

For now it will show "Node.js GitHub Bot" (https://github.com/nodejs/node/pull/34112/files#diff-21f285c740fafee2a921678194aef7abR39-R40). Totally feasible to change it to the collaborator who added the label though if we decide that adding the label will count as "active metrics".

Another option is to keep committing as the bot but add Commit-Queue-By (or just Commit-Queue) metadata when landing. That's what V8 does.

MylesBorins pushed a commit that referenced this pull request Aug 17, 2020
This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201

PR-URL: #34112
Refs: https://github.com/mmarchini-oss/automated-merge-test
Refs: nodejs/build#2201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@danielleadams danielleadams mentioned this pull request Aug 20, 2020
BethGriggs pushed a commit that referenced this pull request Aug 20, 2020
This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201

PR-URL: #34112
Refs: https://github.com/mmarchini-oss/automated-merge-test
Refs: nodejs/build#2201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201

PR-URL: #34112
Refs: https://github.com/mmarchini-oss/automated-merge-test
Refs: nodejs/build#2201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
This is a (still experimental) implementation of a Commit Queue on
GitHub Actions, using labels and the scheduler event to land Pull
Requests. It uses `node-core-utils` to validate Pull Requests and to
prepare the commit message, and then it uses a GitHub personal token to
push changes back to the repository. If the Queue fails to land a Pull
Request, that PR will be removed from the queue and the
`node-core-utils` output will be pasted in the Pull Request.

An overview of the implementation is provided in
doc/guides/commit-queue.md, as well as current limitations.

Ref: https://github.com/mmarchini-oss/automated-merge-test
Ref: nodejs/build#2201

PR-URL: #34112
Refs: https://github.com/mmarchini-oss/automated-merge-test
Refs: nodejs/build#2201
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
@codebytere codebytere mentioned this pull request Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet