-
Notifications
You must be signed in to change notification settings - Fork 29
SEAB-6000: Track GitHub App UNINSTALL events #5852
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
Conversation
LOG.info(String.format("Retrospectively processing branch/tag %s in %s(%s)", Utilities.cleanForLogging(gitReference), Utilities.cleanForLogging(repository), | ||
Utilities.cleanForLogging(username))); | ||
} | ||
githubWebhookRelease(repository, username, gitReference, installationId, deliveryId, null, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in this block didn't change, it's indented one level because it's now conditional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Hide whitespace" option works well too
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5852 +/- ##
=============================================
- Coverage 73.04% 70.18% -2.86%
+ Complexity 5142 4957 -185
=============================================
Files 366 366
Lines 18974 19000 +26
Branches 2020 2025 +5
=============================================
- Hits 13860 13336 -524
- Misses 4137 4694 +557
+ Partials 977 970 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@JsonProperty("repositories_added") | ||
@Schema(name = "repositories_added", description = "An array of repository objects, which were added to the installation", requiredMode = RequiredMode.REQUIRED) | ||
private List<WebhookRepository> repositoriesAdded; | ||
|
||
@JsonProperty("repositories_removed") | ||
@Schema(name = "repositories_removed", description = "An array of repository objects, which were removed from the installation", requiredMode = RequiredMode.REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL they're working on an openapi 4 for things like this (i.e. either this parameter or this other one OAI/OpenAPI-Specification#256 (comment) )
i.e. it's a little weird that both repositoriesRemoved
and repositoriesAdded
are required
final String action = payload.getAction(); | ||
// Currently, the action can be either "added" or "removed". | ||
// This check is not necessary, but will detect if github adds another type of action to the event. | ||
if (!List.of("added", "removed").contains(action)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Share an enum with dockstore-integration-testing/src/test/java/io/dockstore/webservice/helpers/GitHubAppHelper.java
so that if one is changed, the future me knows to change the other at the same time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And link to installation_repositories
I suppose
LOG.info(String.format("Retrospectively processing branch/tag %s in %s(%s)", Utilities.cleanForLogging(gitReference), Utilities.cleanForLogging(repository), | ||
Utilities.cleanForLogging(username))); | ||
} | ||
githubWebhookRelease(repository, username, gitReference, installationId, deliveryId, null, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The rea 8000 son will be displayed to describe this comment to others. Learn more.
"Hide whitespace" option works well too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I like Denis' suggestion of an enum, so I'll wait for that change for final approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was here, I agree with Denis' feedback so will wait for that
|
@@ -56,6 +56,16 @@ public static void handleGitHubRelease(WorkflowsApi workflowsApi, String reposit | |||
public static void handleGitHubInstallation(WorkflowsApi workflowsApi, List<String> repositories, String gitHubUsername) { | |||
InstallationRepositoriesPayload payload = new InstallationRepositoriesPayload() | |||
.repositoriesAdded(repositories.stream().map(repo -> new WebhookRepository().fullName(repo)).toList()); | |||
payload.setAction(io.dockstore.webservice.core.webhook.InstallationRepositoriesPayload.Action.ADDED.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could import io.dockstore.webservice.core.webhook.InstallationRepositoriesPayload
to make this a bit more concise, not worth changing unless there are other changes
Description
The
installation_repositories
GitHub event can describe either additions or removals, depending on the value of its "action" property. This PR modifieshandleGitHubInstallation
to handle the "removed" action of a propagated GitHubinstallation_repositories
event and adds a correspondingUNINSTALL
lambda event type.The corresponding lambda PR is dockstore/lambda#161
Review Instructions
Add the qa GitHub App to a repo, wait five minutes, and confirm that the corresponding INSTALL entry appears in the apps logs. Then, remove the GitHub App from the repo, wait five minutes, and confirm that the corresponding UNINSTALL entry appears in the apps logs. Confirm that in the apps logs, "Uninstall" is properly capitalized.
Issue
https://ucsc-cgl.atlassian.net/browse/SEAB-6000
Security and Privacy
No concerns.
e.g. Does this change...
Please make sure that you've checked the following before submitting your pull request. Thanks!
mvn clean install
@RolesAllowed
annotation