-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bug 1875338 - Update the clean-up script to manage each package in the product delivery repository #7
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 17.05% 25.00% +7.94%
==========================================
Files 2 2
Lines 170 116 -54
Branches 32 16 -16
==========================================
Hits 29 29
+ Misses 141 87 -54 ☔ View full report in Codecov by Sentry. |
0fc7c3c
to
ad60f6e
Compare
…e product delivery repository I hacked together the clean-up script as fast as I could to mitigate the Nightly channel growing. These changes update the script to mange each Mozilla product package in the product delivery repository.
ad60f6e
to
1cda5d3
Compare
7aa4a24
to
076af01
Compare
076af01
to
9520374
Compare
I realize these are a lot of changes. The main thing I did was switch from scraping the raw repository meta data files to using the artifact registry APIs. The package selection is done using a regex now, so it is flexible enough to handle different products and product flavors. Another thing to note, is that switching to the artifact registry APIs allows me to use the SDKs built-in retry mechanism. These is an example of using the script to do a clean-up dry-run for devedition/beta packages: mozilla-linux-pkg-manager \
clean-up \
--package "^firefox-(devedition|beta)(-l10n-.+)?$" \
--retention-days 60 \
--repository mozilla \
--region us \
--skip-delete \
2>&1 | tee clean-up-devedition-and-beta.log Also, I started working on unit tests for this module, but I decided to branch off and do a follow up, so that devedition and beta don't get to bloated and we can keep the repository's index size hovering around the same number. Here's what that looks like so far: 67b0832 |
Here's a fresh log: devedition-beta-moz-fx-productdelivery-pr-38b5.log |
Here's one from the staging environment: devedition-beta-moz-fx-productdelivery-no-7d6a.log and one here's on from dev: all-packages-moz-fx-dev-releng.log |
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.
Do we have another place that these are stored for the long term, or are we OK deleting them forever? I will note that other nightlies and releases are kept forever on archive.mozilla.org for bisection and future debugging purposes - so deleting these packages forever would be going against the grain.
) | ||
clean_up_parser.add_argument( | ||
"--dry-run", | ||
action="store_true", | ||
help="Do a no-op run and print out a summary of the operations that will be executed", | ||
default=False, | ||
) | ||
clean_up_parser.add_argument( |
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.
What is the benefit of skip-delete
vs. running in dry-run
mode? It looks to me like the latter is a more extensive test, at perhaps the cost of some extra network costs?
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 difference is dry-run
will fail if the SDK doesn't have delete permissions on the resource.
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.
Ah - I see. So this allows for running a dry run with a lower permissioned account - makes sense!
if pattern.match(name): | ||
logging.info(f"Looking for expired package versions of {name}...") | ||
versions = await list_versions(package) | ||
async for version in versions: |
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.
I think you either want to drop the async
here or use async for version in list_versions(package)
. As far as I can tell, versions
is already a simple list as things are written now (because you await
'ed it). The same thing applies a bit further up with packages
.
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 client returns async
iterators.
For ex. ListPackagesAsyncPager in the case of list_versions
(not a plain list
.)
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.
Oh my bad - sorry! Yes, you're absolutely right.
src/mozilla_linux_pkg_manager/cli.py
Outdated
for batch in batches: | ||
logging.info( | ||
f"Deleting {format(len(batch), ',')} expired package versions for {package}." | ||
f"Deleting {format(len(batch), ',')} expired package versions of {os.path.basename(package)}" |
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.
Please change this log message when in dry run mode - "Deleting ..." is not accurate for that case. "Would delete ..." or something similar would be better.
These .debs have to be stored in the archive before they can be in the APT repository. We don't do direct uploads to the repository, we import the packages from the archive (and they are kept in the archive forever.) |
OK, great! |
I hacked together the clean-up script as fast as I could to mitigate the Nightly channel growing. These changes update the script to mange each Mozilla product package in the product delivery repository.
See: https://bugzilla.mozilla.org/show_bug.cgi?id=1875338