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

Remove resource config validation for github-events-to-s3 call #36

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

bshien
Copy link
Contributor

@bshien bshien commented Nov 7, 2024

Description

Remove resource config validation in github-events-to-s3 call to allow the app to listen on events from all repos, then filter only for public repos. This way, when a new repo is added, the app can start acting on the new repo's events immediately.

Additionally ran a prettier --write .

Issues Resolved

Part of opensearch-project/opensearch-metrics#76

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.44%. Comparing base (b3e35e6) to head (6af6ae5).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #36   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files          10       10           
  Lines         180      181    +1     
  Branches       25       25           
=======================================
+ Hits          179      180    +1     
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterzhuamazon
Copy link
Member

Hi @bshien rebase on main please I just update the main branch yesterday.

Thanks.

Signed-off-by: Brandon Shien <bshien@amazon.com>
if (!(await validateResourceConfig(app, context, resource))) return;
export default async function githubEventsToS3(app: Probot, context: any): Promise<void> {
// Removed validateResourceConfig to let this function listen on all repos, and filter for only the repos that are public.
// This is done so when a new repo is made public, this app can automatically start processing its events.
Copy link
Member

Choose a reason for hiding this comment

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

Please add one more comment along the lines of:

This is only for the s3 data lake specific case, everything else should still specify repos required to be listened in resource config.

// Removed validateResourceConfig to let this function listen on all repos, and filter for only the repos that are public.
// This is done so when a new repo is made public, this app can automatically start processing its events.
// if (!(await validateResourceConfig(app, context, resource))) return;
if (context.payload.repository?.private === false) {
Copy link
Member

Choose a reason for hiding this comment

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

Wonder if we need an else branch to log which repo is skipped due to being private.


await githubEventsToS3(app, context);

expect(mockS3Client.send).not.toHaveBeenCalledWith(expect.any(PutObjectCommand));
Copy link
Member

Choose a reason for hiding this comment

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

If you add an app.log.error for private repo then you can check if that is being called when repo is private.

Signed-off-by: Brandon Shien <bshien@amazon.com>
@peterzhuamazon peterzhuamazon merged commit 4a90494 into opensearch-project:main Nov 7, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants