Skip to content

Make function to dump PackageRevisionResources a utility function#966

Merged
liamfallon merged 4 commits into
kptdev:mainfrom
Nordix:prr-dump
May 4, 2026
Merged

Make function to dump PackageRevisionResources a utility function#966
liamfallon merged 4 commits into
kptdev:mainfrom
Nordix:prr-dump

Conversation

@liamfallon

@liamfallon liamfallon commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Make function to dump PackageRevisionResources a utility function


Description

  • What changed: The writeResourcesToFS() function already existed in the package rendering code. This PR moves it out to a utility function and makes it globally visible as WriteResourcesToFS().
  • Why it’s needed: This function is very useful for dumping the PackageRevisionResources for a PR to disk while debugging
  • How it works: The existing function is moved and made visible.

Type of Change

  • Bug fix
  • New feature
  • Enhancement
  • Refactor
  • Documentation
  • Tests
  • Other: ________

Checklist

  • Code follows project style guidelines
  • Self-reviewed changes
  • Tests added/updated
  • Documentation added/updated
  • All tests and gating checks pass

AI Disclosure

[x] I have used AI in the creation of this PR.

  • I used Amazon Q ti generate the unit tests for the WriteResourcesToFS() function, the original function had no test coverage.

…unction and make visible

Signed-off-by: liamfallon <liam.fallon@est.tech>
Copilot AI review requested due to automatic review settings April 30, 2026 16:34
@netlify

netlify Bot commented Apr 30, 2026

Copy link
Copy Markdown

Deploy Preview for porch ready!

Name Link
🔨 Latest commit c834aff
🔍 Latest deploy log https://app.netlify.com/projects/porch/deploys/69f398a1923b5a0008f90631
😎 Deploy Preview https://deploy-preview-966--porch.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the package rendering path to reuse a shared utility for writing PackageRevisionResources into a kyaml/filesys filesystem, making it easier to dump resources to disk for debugging.

Changes:

  • Adds exported repository.WriteResourcesToFS(fs, rootDir, resources) utility.
  • Updates the package revision renderer to call the new utility and removes the local helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pkg/repository/util.go Introduces exported WriteResourcesToFS helper for persisting resource maps into a filesys.FileSystem.
controllers/packagerevisions/pkg/controllers/packagerevision/render.go Switches renderer to use repository.WriteResourcesToFS and deletes the old local implementation.

Comment thread pkg/repository/util.go Outdated
Comment thread pkg/repository/util.go
Comment thread pkg/repository/util.go
Signed-off-by: liamfallon <liam.fallon@est.tech>
Signed-off-by: liamfallon <liam.fallon@est.tech>
Copilot AI review requested due to automatic review settings April 30, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the package rendering helper that writes PackageRevisionResources into a kyaml filesystem by moving it into pkg/repository as a public utility (WriteResourcesToFS), and adds documentation + unit tests to support debugging workflows.

Changes:

  • Extracts and exports WriteResourcesToFS() into pkg/repository/util.go.
  • Updates the package render controller to call the new utility.
  • Adds unit tests and troubleshooting docs showing how to dump resources to disk.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
pkg/repository/util.go Adds exported WriteResourcesToFS() utility for writing resource maps into a kyaml FileSystem.
controllers/packagerevisions/pkg/controllers/packagerevision/render.go Switches renderer to use repository.WriteResourcesToFS() instead of a local helper.
pkg/repository/util_test.go Adds test coverage for WriteResourcesToFS() behavior (root, nested paths, rootDir).
docs/content/en/docs/9_troubleshooting_and_faq/lazy-dog/_index.md Documents using WriteResourcesToFS() to dump “before/after” resources during render debugging.

Comment thread pkg/repository/util.go Outdated
Comment thread pkg/repository/util.go
Comment thread docs/content/en/docs/9_troubleshooting_and_faq/lazy-dog/_index.md Outdated
Comment thread pkg/repository/util.go
Signed-off-by: liamfallon <liam.fallon@est.tech>
@sonarqubecloud

Copy link
Copy Markdown

@liamfallon liamfallon merged commit 7cc5141 into kptdev:main May 4, 2026
33 of 39 checks passed
@efiacor efiacor deleted the prr-dump branch May 5, 2026 07:58
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.

3 participants