This repository was archived by the owner on Sep 30, 2024. It is now read-only.
batches: fix commit signing with changeset forks#57520
Merged
Merged
Conversation
360027d to
e9dba11
Compare
Contributor
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 6c70bc1...8fc845b.
|
camdencheek
approved these changes
Oct 11, 2023
Co-authored-by: Camden Cheek <camden@ccheek.com>
BolajiOlajide
added a commit
that referenced
this pull request
Oct 12, 2023
This reverts commit 8eb5d83.
sourcegraph-release-bot
pushed a commit
that referenced
this pull request
Oct 13, 2023
[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)
keegancsmith
pushed a commit
that referenced
this pull request
Oct 14, 2023
batches: fix commit signing with changeset forks (#57520) [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) Co-authored-by: Bolaji Olajide <25608335+BolajiOlajide@users.noreply.github.com>
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.