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

add needs_webhook_secret_backfill to upload task #521

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

nora-codecov
Copy link
Contributor

set up the webhook_secret in passing if it is empty - starts the fix for https://github.com/codecov/internal-issues/issues/366

Copy link

sentry-io bot commented Jun 25, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: tasks/upload.py

Function Unhandled Issue
run_impl_within_lock NoConfiguredAppsAvailable app.tasks.upload.Upload
Event Count: 8

Did you find this useful? React with a 👍 or 👎

@codecov-notifications
Copy link

codecov-notifications bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #521   +/-   ##
=======================================
  Coverage   97.47%   97.48%           
=======================================
  Files         418      418           
  Lines       34900    34973   +73     
=======================================
+ Hits        34020    34093   +73     
  Misses        880      880           
Flag Coverage Δ
integration 97.48% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.48% <100.00%> (+<0.01%) ⬆️
unit 97.48% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.53% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
services/repository.py 96.34% <100.00%> (+0.05%) ⬆️
tasks/tests/unit/test_upload_task.py 99.55% <100.00%> (+0.04%) ⬆️
tasks/upload.py 91.52% <100.00%> (+0.07%) ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (6b8726c) to head (e462d40).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #521   +/-   ##
=======================================
  Coverage   97.47%   97.48%           
=======================================
  Files         418      418           
  Lines       34900    34973   +73     
=======================================
+ Hits        34020    34093   +73     
  Misses        880      880           
Flag Coverage Δ
integration 97.48% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.48% <100.00%> (+<0.01%) ⬆️
unit 97.48% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.53% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
services/repository.py 96.34% <100.00%> (+0.05%) ⬆️
tasks/tests/unit/test_upload_task.py 99.55% <100.00%> (+0.04%) ⬆️
tasks/upload.py 91.52% <100.00%> (+0.07%) ⬆️

Copy link

codecov-public-qa bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (6b8726c) to head (e462d40).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #521   +/-   ##
=======================================
  Coverage   97.47%   97.48%           
=======================================
  Files         418      418           
  Lines       34900    34973   +73     
=======================================
+ Hits        34020    34093   +73     
  Misses        880      880           
Flag Coverage Δ
integration 97.48% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.48% <100.00%> (+<0.01%) ⬆️
unit 97.48% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.53% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
services/repository.py 96.34% <100.00%> (+0.05%) ⬆️
tasks/tests/unit/test_upload_task.py 99.55% <100.00%> (+0.04%) ⬆️
tasks/upload.py 91.52% <100.00%> (+0.07%) ⬆️

Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.50%. Comparing base (6b8726c) to head (e462d40).

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #521   +/-   ##
=======================================
  Coverage   97.50%   97.50%           
=======================================
  Files         449      449           
  Lines       35623    35696   +73     
=======================================
+ Hits        34733    34806   +73     
  Misses        890      890           
Flag Coverage Δ
integration 97.48% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.48% <100.00%> (+<0.01%) ⬆️
unit 97.48% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.58% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.74% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
services/repository.py Critical 96.34% <100.00%> (+0.05%) ⬆️
tasks/tests/unit/test_upload_task.py 99.55% <100.00%> (+0.04%) ⬆️
tasks/upload.py Critical 91.57% <100.00%> (+0.07%) ⬆️
Related Entrypoints
run/app.tasks.upload.Upload

tasks/upload.py Outdated
action="EDIT",
),
)

if webhook_secret is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this conditional/line be inside the if repository_service.service in ["gitlab", "gitlab_enterprise"]: check? So like

if repository_service.service in ["gitlab", "gitlab_enterprise"]:
                    # we use per-repo webhook secrets in this case
                    webhook_secret = repository.webhook_secret or str(uuid.uuid4())
                    repository.webhook_secret = webhook_secret

And we then get rid of the this if statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it! updating

tasks/upload.py Outdated
repo_data["repo"]["hookid"] = hookid
return True

return True if should_post_webhook else False
Copy link
Contributor

Choose a reason for hiding this comment

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

With the other suggestion above, I think it'd be a bit more readable to put return True in the should_post_webhook conditional, and false in the else in 993, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree! updating

Copy link
Contributor

@adrian-codecov adrian-codecov left a comment

Choose a reason for hiding this comment

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

Lefts some comments/suggestions but overall lgtm!

@nora-codecov nora-codecov added this pull request to the merge queue Jun 27, 2024
Merged via the queue into main with commit 646d815 Jun 27, 2024
41 of 43 checks passed
@nora-codecov nora-codecov deleted the nora/366 branch June 27, 2024 18:40
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