Skip to content

github actions: Fix test-one-commit when parent of head is merge commit - #28573

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
ryanofsky:pr/onecommit
Oct 9, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
ryanofsky:pr/onecommit

Conversation

@ryanofsky

@ryanofsky ryanofsky commented Oct 3, 2023 •

Copy link
Copy Markdown
Contributor

Instead of figuring out the commit after the last merge and rebasing on that with a ~1 suffix, just figure out the last merge commit directly and rebase on it. This way, if HEAD happens to be a merge commit, the rebase just succeeds immediately without blank variables or errors.

Explanation of the problem from #28497 (comment):

The problem is that the PR only contains a one commit after the last merge, so the job should be skipped, but the pull_request.commits != 1 check is not smart enough to skip it because the PR is based on another PR and has merge ancestor commits. So specifically what happens is that after HEAD~ is checked out, the new HEAD is a merge commit, so the range $(git log --merges -1 --format=%H)..HEAD is equivalent to HEAD..HEAD, which is empty, so the COMMIT_AFTER_LAST_MERGE variable is empty and the rebase command fails.

Note: In the current version of this PR, the "test each commit" job is skipped, because this PR only contains a single commit. But I manually verified the code works in earlier versions of the PR that included dummy commits.

@DrahtBot

DrahtBot commented Oct 3, 2023 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK MarcoFalke, RandyMcMillan

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

No conflicts as of last run.

@DrahtBot

DrahtBot commented Oct 4, 2023

Copy link
Copy Markdown
Contributor

Guix builds (on x86_64)

File commit 97f756b
(master)
commit 6307893d248c73c29d449eaf4749fb6e77a09491
(master and this pull)
SHA256SUMS.part fa4d8592bca59c4a... 1306ba4631a4ef15...
*-aarch64-linux-gnu-debug.tar.gz 5580ec85fb2ce064... 459a52f461d39e59...
*-aarch64-linux-gnu.tar.gz 78b6d232d5120a1b... b957063d725ce128...
*-arm-linux-gnueabihf-debug.tar.gz 3d982ec7d8bf74c8... e6763e27bc2760fb...
*-arm-linux-gnueabihf.tar.gz d668677bff8761e9... e3bb01f3bd1ae2b7...
*-arm64-apple-darwin-unsigned.tar.gz 27d5c72f99042fd1... 4fbe35f8c9c26506...
*-arm64-apple-darwin-unsigned.zip 0a40c1c9d69914d8... df1c30ac6d0026d6...
*-arm64-apple-darwin.tar.gz 58a0486742a08c78... 9f78f7648ac61eaa...
*-powerpc64-linux-gnu-debug.tar.gz e995b1125000df19... 5611a7db5002f33e...
*-powerpc64-linux-gnu.tar.gz a299139b47c371a6... 16ceeb250faf19f2...
*-powerpc64le-linux-gnu-debug.tar.gz 9a7bceae7ca985ff... 4a83cd3ec117031d...
*-powerpc64le-linux-gnu.tar.gz ceffc3d58f9a85c9... 164bc2e891b49173...
*-riscv64-linux-gnu-debug.tar.gz 2fbc6bb55aca9e4d... c0163cb35062c278...
*-riscv64-linux-gnu.tar.gz 0e4f173506cd129a... bb2753593fcad11d...
*-x86_64-apple-darwin-unsigned.tar.gz 8d369cd8f6307c6d... 984c45b5b11cd568...
*-x86_64-apple-darwin-unsigned.zip 79fd330511b22d30... 051a60c655956a3c...
*-x86_64-apple-darwin.tar.gz 4823f3b58d113f18... e5588ef943838709...
*-x86_64-linux-gnu-debug.tar.gz 3dc47f3e2f985104... 53973ff976b337b0...
*-x86_64-linux-gnu.tar.gz ea95470b6d8861d4... 7ea69e767ccb06cb...
*.tar.gz c40470ff5c25bfb3... 2f81ff640a1831ea...
guix_build.log adc6a469498c651d... 4b83bdc86274211c...
guix_build.log.diff e062eb0dad2a14ba...

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review

Updated 3447796 -> a327191 (pr/onecommit.4 -> pr/onecommit.5, compare) just adding comment

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
@DrahtBot DrahtBot removed the CI failed label Oct 5, 2023

@maflcko maflcko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

Comment thread .github/workflows/ci.yml Resolved
@maflcko

maflcko commented Oct 5, 2023

Copy link
Copy Markdown
Member

lgtmcr ACK a327191

Instead of figuring out the commit *after* the last merge and rebasing on that
with a ~1 suffix, just figure out the last merge commit directly and rebase on
it. This way, if HEAD happens to be a merge commit, the rebase just succeeds
immediately without blank variables or errors.

From bitcoin#28497 (comment):

    The problem is that the PR only contains a one commit after the last merge,
    so the job _should_ be skipped, but the `pull_request.commits != 1` check
    is not smart enough to skip it because the PR is based on another PR and
    has merge ancestor commits. So specifically what happens is that after
    HEAD~ is checked out, the new HEAD is a merge commit, so the range `$(git
    log --merges -1 --format=%H)..HEAD` is equivalent to HEAD..HEAD, which is
    empty, so the `COMMIT_AFTER_LAST_MERGE` variable is empty and the rebase
    command fails.

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated a327191 -> 88c8e3a (pr/onecommit.5 -> pr/onecommit.6, compare) updating comment again

Comment thread .github/workflows/ci.yml Resolved
@maflcko

maflcko commented Oct 5, 2023

Copy link
Copy Markdown
Member

lgtmrecr ACK 88c8e3a

@RandyMcMillan

Copy link
Copy Markdown
Contributor

utACK 88c8e3a

@fanquake
fanquake merged commit 4e7442e into bitcoin:master Oct 9, 2023
Frank-GER pushed a commit to syscoin/syscoin that referenced this pull request Oct 13, 2023
…of head is merge commit

88c8e3a github actions: Fix test-one-commit when parent of head is merge commit (Ryan Ofsky)

Pull request description:

  Instead of figuring out the commit *after* the last merge and rebasing on that with a ~1 suffix, just figure out the last merge commit directly and rebase on it. This way, if HEAD happens to be a merge commit, the rebase just succeeds immediately without blank variables or errors.

  Explanation of the problem from bitcoin#28497 (comment):

  > The problem is that the PR only contains a one commit after the last merge, so the job _should_ be skipped, but the `pull_request.commits != 1` check is not smart enough to skip it because the PR is based on another PR and has merge ancestor commits. So specifically what happens is that after HEAD~ is checked out, the new HEAD  is a merge commit, so the range `$(git log --merges -1 --format=%H)..HEAD` is equivalent to HEAD..HEAD, which is empty, so the `COMMIT_AFTER_LAST_MERGE` variable is empty and the rebase command fails.

  Note: In the current version of this PR, the "test each commit" job is skipped, because this PR only contains a single commit. But I manually verified the code works in earlier versions of the PR that included dummy commits.

ACKs for top commit:
  maflcko:
    lgtmrecr ACK 88c8e3a
  RandyMcMillan:
    utACK 88c8e3a

Tree-SHA512: a6865b5c8b96eb0b622b3255971a3cf050dd0f5a356cdfcf7f0cbb659e4a363612e8e62b3ae4fd6b5d9a40bc29176891bc4690659b026c5ef8feea25c8e263cc
@bitcoin bitcoin locked and limited conversation to collaborators Oct 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants