Cherry-pick: Add package resource file sizes to PackageRevision interface (#954)#1015
Open
JamesMcDermott wants to merge 1 commit into
Open
Cherry-pick: Add package resource file sizes to PackageRevision interface (#954)#1015JamesMcDermott wants to merge 1 commit into
JamesMcDermott wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new ResourcesSizeBytes field to PackageRevisionStatus that exposes the total size of a package revision's resource files (currently computed only by the DB cache), along with supporting schema migrations, end-to-end test helpers, and assorted comment/typo cleanups.
Changes:
- Adds
resources_sizecolumn to thepackage_revisionstable (schema + migration scripts) and threads a newresourcesSizeBytesfield throughdbPackageRevisionso the API surfaces it inPackageRevisionStatus. - Introduces
TestSuite.UsingDBCache(driven by theDB_CACHEenv var) and a sharedvalidatePackageResourcesSizehelper used across e2e tests; also adds tests for placeholder/main package revision edit/upgrade rejection. - Cleans up assorted typos, comments, and copyright headers in API, docs, and engine code.
Reviewed changes
Copilot reviewed 25 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| api/porch/types.go | Adds ResourcesSizeBytes to status; fixes comment typos. |
| api/porch/v1alpha1/types.go | Mirrors above for v1alpha1. |
| api/sql/porch-db.sql | Adds resources_size column to base schema. |
| api/sql/porch-db-1.5.9-1.5.10.sql | New forward migration adding/backfilling resources_size. |
| api/sql/porch-db-1.5.10-1.5.9.sql | New rollback migration dropping resources_size. |
| api/sql/porch-db-1.5.9-1.6.0.sql | Duplicate forward migration for 1.6.0. |
| api/sql/porch-db-1.6.0-1.5.9.sql | Duplicate rollback for 1.6.0. |
| controllers/.../packagevariant_controller-with-workspacename_test.go | Copyright year bump. |
| deployments/porch/3-porch-postgres-bundle.yaml | Mirrors schema column addition for bundled deployment. |
| docs/.../package-revisions.md | Cleans up sample YAML/CLI output. |
| docs/.../db-cache.md | Documents draft close size summation. |
| docs/.../api-ref.md | Documents new resourcesSizeBytes field. |
| pkg/cache/dbcache/dbpackagerevision.go | Stores/propagates resourcesSizeBytes; minor fixes. |
| pkg/cache/dbcache/dbpackagerevisionsql.go | SQL read/insert/update statements include resources_size. |
| pkg/cache/dbcache/dbrepository.go | Recomputes size on ClosePackageRevisionDraft. |
| pkg/cache/dbcache/dbreposync.go | Computes size during external PR sync. |
| pkg/engine/engine.go | Comment fixes. |
| pkg/externalrepo/git/doc.go | Comment typo fix. |
| pkg/task/generictaskhandler.go | Error message typo fix. |
| test/e2e/api/*.go | New validatePackageResourcesSize helper and additional placeholder edit/upgrade tests. |
| test/e2e/suiteutils/suite.go | Adds UsingDBCache and repoControllerInCluster fields. |
Files not reviewed (1)
- api/porch/v1alpha1/zz_generated.conversion.go: Language not supported
a2eceed to
4959501
Compare
) * Feat: add package resource file sizes to PackageRevision interface - on ClosePackageRevisionDraft: - add up individual sizes of PackageRevisionResources - store total as a separate metadata field in package_revisions table - on get/list PackageRevision, include total resources size in status field of returned API object kptdev#811 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Update documentation to include new size-on-disk field - document new API field `prrSizeOnDisk` - include new "SIZE ON DISK" table column in `rpkg get` output examples Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * missed some generated bits Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Fix tests, revert "Size on Disk" column from PackageRevision table - fix E2E tests by excluding package-size testing from E2E tests for CR cache - new mechanism in test suite to detect DB cache when in use - can be used in test cases to exclude/include portions depending on cache - remove "Size on Disk" column from `kubectl get packagerevisions` table - agreed not essential information, may set precedent to overload table output - also removes need for updates to E2E CLI tests Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * unit test fixes after table column reversion Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * update e2e tests' expectations Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address review comments Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address review comments part 2 - also remove restriction that meant size didn't get updated on PackageRevisionResources update Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * fix failing CR-cache E2E tests Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * replace missed nephio-project imports with kptdev Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 2 Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * ssimplify tests' DB cache detection - missed Copilot review comment Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com> * nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 3 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * comment nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 4 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * nitpick to retrigger CI Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 5 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> * Address Copilot review comments part 6 Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> --------- Signed-off-by: James McDermott <james.j.mcdermott@ericsson.com> Signed-off-by: ezmcdja <james.j.mcdermott@ericsson.com>
4959501 to
0e49526
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Title
Cherry-pick to 1.5: Add package resource file sizes to PackageRevision interface (#954)
Description
Related Issue(s)
Type of Change
Checklist
Testing Instructions (Optional)
Additional Notes (Optional)