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

ci: block non-linear merges #11277

Merged
merged 1 commit into from Nov 8, 2022
Merged

ci: block non-linear merges #11277

merged 1 commit into from Nov 8, 2022

Conversation

AaronFriel
Copy link
Member

@AaronFriel AaronFriel commented Nov 7, 2022

This ensures commit history is linear, enabling customer-owned forks of the pulumi CLI to more easily maintain their fork. Reverse merges into PR branches result in a more complex process for them and for us.

To test this PR, I based my PR branch off an older commit from the target branch and added a merge commit. That resulted in the check failing:
https://github.com/pulumi/pulumi/actions/runs/3416559764/jobs/5686840393

Checking merge commit efb7be0 for non-linear history
Main branch parent is: 83c9dfc Merge #11262
PR branch parents are d9460b9
Checking: d9460b9 Merge remote-tracking branch 'origin/master' into friel/block-reverse-merge
Error: Non-linear history, PR contains a merge d9460b9. Remove this by rebasing on the target.
Error: Detected non-linear history.
Error: Process completed with exit code 1.

Fixes #10903

The script used by this lint contains several "tests" and useful diagnostics. Example outputs:

$ ./scripts/git-linear-history-check.sh f033d9de02a633ad386b09d6dfff810ffe7ddea5
Checking merge commit f033d9de02a633ad386b09d6dfff810ffe7ddea5 for non-linear history
Main branch parent is: 0797f2966 Merge #10817
PR branch parents are 110dd76629cbea137c9b43bf333442765601152c ffbb03c71e715d3dcb93e1f609bc3359d6fbda9e cdf8f20a656ac7e87823b15fe1f5c2384d971a53 396650a814bfa1a64cb1c0b0880e00c20651477b
Checking: 110dd7662 ci: Pin yarn lockfile for security & dependency scanning
Checking: ffbb03c71 ci: Build binary with .exe extension on Windows
Checking: cdf8f20a6 ci: Remove several test skips, check if unnecessary
Checking: 396650a81 ci: Re-enable Windows tests with temp dir
✅ Commit history is linear.
$ ./scripts/git-linear-history-check.sh 0f3e53688fe04ec18180ba87f6915c454023ddf9 
Checking merge commit 0f3e53688fe04ec18180ba87f6915c454023ddf9 for non-linear history
Main branch parent is: bc704afa5 Merge #10703 #10717
PR branch parents are 9065d7caf06ecb970e98a7fba518745038069d9d 22f2989c196daf984d062e75ea18f45ba5e39192 9f5ec4a992c7b1c393cc8518db2a36039db7c6a6
Checking: 9065d7caf refactored defaultServiceLoop into its own method
::error::Non-linear history, PR contains a merge fa09da62271e1cbc9ca6f9a37d6458fcc6d4d90d. Remove this by rebasing on the target.
::error::Non-linear history, PR contains a merge 536f3d6480601fcc541f5cfe7b01124f7fe61f4c. Remove this by rebasing on the target.
Checking: 22f2989c1 ci: Fix package parallelism assignment
Checking: 9f5ec4a99 Add missing `ProgramTestOptions` overrides in `With`
::error::Detected non-linear history.

The ::error:: messages should appear in GitHub Actions logs at the top level (the workflow level) as well as in the detailed output of the action.

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Nov 7, 2022

Changelog

[uncommitted] (2022-11-08)

@AaronFriel AaronFriel changed the title ci: block merge commits from being merged ci: block non-linear merges Nov 7, 2022
@AaronFriel AaronFriel added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Nov 7, 2022
@AaronFriel AaronFriel force-pushed the friel/block-reverse-merge branch 2 times, most recently from 9518384 to 941be35 Compare November 8, 2022 04:53
@AaronFriel AaronFriel force-pushed the friel/block-reverse-merge branch 2 times, most recently from d9460b9 to d14f084 Compare November 8, 2022 05:18
scripts/git-linear-history-check.sh Outdated Show resolved Hide resolved
scripts/git-linear-history-check.sh Outdated Show resolved Hide resolved
@AaronFriel
Copy link
Member Author

bors merge

@bors
Copy link
Contributor

bors bot commented Nov 8, 2022

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

@AaronFriel
Copy link
Member Author

bors merge

bors bot added a commit that referenced this pull request Nov 8, 2022
11277: ci: block non-linear merges r=AaronFriel a=AaronFriel

This ensures commit history is linear, enabling customer-owned forks of the pulumi CLI to more easily maintain their fork. Reverse merges into PR branches result in a more complex process for them and for us.

To test this PR, I based my PR branch off an older commit from the target branch and added a merge commit. That resulted in the check failing:
https://github.com/pulumi/pulumi/actions/runs/3416559764/jobs/5686840393

> Checking merge commit efb7be0  for non-linear history
> Main branch parent is: 83c9dfc Merge #11262
> PR branch parents are d9460b9
> Checking: d9460b9 Merge remote-tracking branch 'origin/master' into friel/block-reverse-merge
> Error: Non-linear history, PR contains a merge d9460b9. Remove this by rebasing on the target.
> Error: Detected non-linear history.
> Error: Process completed with exit code 1.

Fixes #10903

The script used by this lint contains several "tests" and useful diagnostics. Example outputs:

```shell
$ ./scripts/git-linear-history-check.sh f033d9d
Checking merge commit f033d9d for non-linear history
Main branch parent is: 0797f29 Merge #10817
PR branch parents are 110dd76 ffbb03c cdf8f20 396650a
Checking: 110dd76 ci: Pin yarn lockfile for security & dependency scanning
Checking: ffbb03c ci: Build binary with .exe extension on Windows
Checking: cdf8f20 ci: Remove several test skips, check if unnecessary
Checking: 396650a ci: Re-enable Windows tests with temp dir
✅ Commit history is linear.
```

```shell
$ ./scripts/git-linear-history-check.sh 0f3e536 
Checking merge commit 0f3e536 for non-linear history
Main branch parent is: bc704af Merge #10703 #10717
PR branch parents are 9065d7c 22f2989 9f5ec4a
Checking: 9065d7c refactored defaultServiceLoop into its own method
::error::Non-linear history, PR contains a merge fa09da6. Remove this by rebasing on the target.
::error::Non-linear history, PR contains a merge 536f3d6. Remove this by rebasing on the target.
Checking: 22f2989 ci: Fix package parallelism assignment
Checking: 9f5ec4a Add missing `ProgramTestOptions` overrides in `With`
::error::Detected non-linear history.
```

The `::error::` messages should appear in GitHub Actions logs at the top level (the workflow level) as well as in the detailed output of the action. 

Co-authored-by: Aaron Friel <mayreply@aaronfriel.com>
@bors
Copy link
Contributor

bors bot commented Nov 8, 2022

Build failed:

@AaronFriel
Copy link
Member Author

bors retry

@bors
Copy link
Contributor

bors bot commented Nov 8, 2022

Build succeeded:

@bors bors bot merged commit b7d2a7f into master Nov 8, 2022
@pulumi-bot pulumi-bot deleted the friel/block-reverse-merge branch November 8, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: Reverse merge/updating PR branches with merges can interfere with cherry-picks
5 participants