Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tools: abort CQ session when landing several commits
Most PRs are meant to be squashed in one commit when landing. If the
collaborator hasn't been using `fixup!` commits, the CQ lands the PR
as several commits. This change makes the CQ abort by default
when attempting to land several commits, unless there's another
label added to the PR to force squashing or landing as several commits.

Fixes: #40436
Refs: nodejs/node-core-utils#572
  • Loading branch information
aduh95 committed Oct 23, 2021
commit fdd0ac97cce4d541fd7578e9312cb63660ac3f20
8 changes: 7 additions & 1 deletion doc/guides/commit-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ From a high-level, the Commit Queue works as follow:
2. Check if the last Jenkins CI is finished running (if it is not, skip this
PR)
3. Remove the `commit-queue` label
4. Run `git node land <pr>`
4. Run `git node land <pr> --oneCommitMax`
5. If it fails:
1. Abort `git node land` session
2. Add `commit-queue-failed` label to the PR
Expand All @@ -37,6 +37,12 @@ From a high-level, the Commit Queue works as follow:
3. Close the PR
4. Go to next PR in the queue

To make the Commit Queue squash all the commits on a pull request in the first
Comment thread
aduh95 marked this conversation as resolved.
Outdated
one, add the `commit-queue-fixupAll` label.
To make the Commit Queue land a pull request containing several commits, add the
`commit-queue-land-multiple-commits` label. When using this option, make sure
Comment thread
aduh95 marked this conversation as resolved.
Outdated
that all commits are self-contained, meaning every commit should pass all tests.

## Current limitations

The Commit Queue feature is still in early stages, and as such it might not
Expand Down
10 changes: 9 additions & 1 deletion tools/actions/commit-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ for pr in "$@"; do
# Delete the commit queue label
gitHubCurl "$(labelsUrl "$pr")"/"$COMMIT_QUEUE_LABEL" DELETE

git node land --autorebase --yes "$pr" >output 2>&1 || echo "Failed to land #${pr}"
if gitHubCurl "$(labelsUrl "$pr")" GET | jq -e 'map(.name) | index("commit-queue-fixupAll")'; then
MULTIPLE_COMMIT_POLICY="--fixupAll"
elif gitHubCurl "$(labelsUrl "$pr")" GET | jq -e 'map(.name) | index("commit-queue-land-multiple-commits")'; then
MULTIPLE_COMMIT_POLICY=""
else
MULTIPLE_COMMIT_POLICY="--oneCommitMax"
fi

Comment thread
aduh95 marked this conversation as resolved.
git node land --autorebase --yes $MULTIPLE_COMMIT_POLICY "$pr" >output 2>&1 || echo "Failed to land #${pr}"
# cat here otherwise we'll be supressing the output of git node land
cat output

Expand Down