Skip to content

fix: print a valid skeleton import example from the CLI - #5530

Merged
brandtkeller merged 2 commits into
zarf-dev:mainfrom
idebeijer:fix/skeleton-import-snippet
Oct 30, 2026
Merged

brandtkeller merged 2 commits into
zarf-dev:mainfrom
idebeijer:fix/skeleton-import-snippet

Conversation

@idebeijer

Copy link
Copy Markdown
Contributor

Description

Started out simply wanting to move printing out of pkg/packager when I was using Zarf as an SDK with my own logger, where packager.PublishSkeleton still wrote colored YAML straight to stdout. While doing that I noticed the YAML itself was wrong, so this fixes both.

Since #5379 the import example printed after a skeleton publish is built from api.Component, which has no yaml tags, so it comes out with lowercased keys and every empty field. Skeletons are v1alpha1-only, so the CLI now converts it to v1alpha1 before printing, like packageForDisplay.

 zarf package publish <dir> <oci://...>
   packager.PublishSkeleton
     push skeleton
-    print example (api.Component, colored, to stdout)
+  fetch published zarf.yaml
+  packager.SkeletonImportExample (api.Component)
+  convert to v1alpha1
+  print example

The fetch discards parse warnings since publish already showed them, and failing to print the example only logs a warning because the skeleton is already published.

Before (v0.88.0, truncated):

- name: import-demo
  description: ""
  optional: false
  ...
  import:
    local: []
    remote:
    - url: oci://localhost:5055/skeletons/sdk-logger-demo:0.0.1
    name: demo
  ...
  imagearchives: []
  ...

After:

- name: import-demo
  required: true
  import:
    name: demo
    url: oci://localhost:5055/skeletons/sdk-logger-demo:0.0.1

The only difference from v0.86.0 is required: true, which the v1alpha1 converter always sets. Otherwise CLI output is unchanged, and there's no change to the package format or existing function signatures.

Related Issue

Relates to #5379

Checklist before merging

Since zarf-dev#5379 the import example printed after publishing a skeleton was
built from api.Component, which has no yaml tags, so it came out with
lowercased keys and every empty field. Convert it to v1alpha1 before
printing and print it from the CLI instead of PublishSkeleton, so SDK
callers no longer get colored YAML on stdout.

Signed-off-by: Igor de Beijer <hi@idebeijer.com>
@idebeijer
idebeijer requested review from a team as code owners October 24, 2026 21:09
@netlify

netlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for zarf-docs ready!

Name Link
🔨 Latest commit 246b490
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6adfacce10fe16f388350f78
😎 Deploy Preview https://deploy-preview-5530--zarf-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 31.57895% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cmd/package.go 31.57% 26 Missing ⚠️
Files with missing lines Coverage Δ
src/pkg/packager/publish.go 67.21% <ø> (-1.13%) ⬇️
src/cmd/package.go 45.53% <31.57%> (-0.22%) ⬇️

... and 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AustinAbro321 AustinAbro321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for finding this and making the PR. Agree there is a bug in the formatting, also definitely makes sense for this to live at the CLI level

Comment thread src/cmd/package.go Resolved
Comment thread src/cmd/package.go Resolved
@github-project-automation github-project-automation Bot moved this to In progress in Zarf Oct 26, 2026
Signed-off-by: Igor de Beijer <hi@idebeijer.com>

@AustinAbro321 AustinAbro321 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice work

@brandtkeller brandtkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm - thanks for taking the initiative here.

@brandtkeller
brandtkeller added this pull request to the merge queue Oct 30, 2026
Merged via the queue into zarf-dev:main with commit a9d5dd5 Oct 30, 2026
31 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Zarf Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants