This repository was archived by the owner on Sep 30, 2024. It is now read-only.
[Backport 5.2] batches: fix commit signing with changeset forks#57597
Merged
Conversation
[Context](https://sourcegraph.slack.com/archives/C04UV9ZVBB2/p1696374182439959) The customer reported an issue where a Sourcegraph instance configured with a GitHub app for Batch Changes couldn't sign commits on forked changesets even when the GitHub app was granted access to the forked repo. This happens because while creating an authenticator used to create the signed commits, we always assume the repository to find the GitHub app installation for is the original repository where the Batch CHange was executed. https://github.com/sourcegraph/sourcegraph/blob/main/internal/batches/sources/sources.go#L161 In this PR, I changed the approach and instead checked if the changeset is pushed to a fork, then figured out the namespace where the forked changeset is created and used that to get the GitHub app installation record.  ## Test plan * MAnual testing - Add a GitHub app for BAtch Changes commit signing. Ensure you give it access to the forked repository of your choice. - Add `batchChanges.enforceForks` to your site config, and create a batch change. - The changeset should be verified and created in your repository fork once published. * Updated unit tests (cherry picked from commit 8eb5d83)
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 461cf0e...2555c92.
|
BolajiOlajide
approved these changes
Oct 13, 2023
Contributor
Member
|
Changelog for 5.2.1 on main pls |
Contributor
Waiting for a 👍🏾 here: https://github.com/sourcegraph/sourcegraph/pull/57598. It'll be in |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The customer reported an issue where a Sourcegraph instance configured with a GitHub app for Batch Changes couldn't sign commits on forked changesets even when the GitHub app was granted access to the forked repo.
This happens because while creating an authenticator used to create the signed commits, we always assume the repository to find the GitHub app installation for is the original repository where the Batch CHange was executed.
https://github.com/sourcegraph/sourcegraph/blob/main/internal/batches/sources/sources.go#L161
In this PR, I changed the approach and instead checked if the changeset is pushed to a fork, then figured out the namespace where the forked changeset is created and used that to get the GitHub app installation record.
Test plan
batchChanges.enforceForksto your site config, and create a batch change.Backport 8eb5d83 from batches: fix commit signing with changeset forks #57520