add dry-run flag for sync --products#547
Merged
zackbradys merged 1 commit intohauler-dev:mainfrom Apr 14, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a --dry-run mode for hauler store sync --products to fetch the product manifest from the product registry and emit its contents to stdout instead of syncing referenced artifacts.
Changes:
- Introduces
--dry-runflag onstore syncand wires it into sync options. - Implements a dry-run execution path that fetches the product manifest image remotely and streams manifest content to stdout.
- Adds CLI validation/log suppression for dry-run and a new dry-run-focused unit test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| internal/flags/sync.go | Adds DryRun to SyncOpts and registers the --dry-run flag. |
| cmd/hauler/cli/store/sync.go | Implements dry-run behavior for --products by fetching and printing the manifest content. |
| cmd/hauler/cli/store/sync_test.go | Adds a test verifying dry-run prints manifest YAML and does not write to the store. |
| cmd/hauler/cli/store.go | Validates --dry-run requires --products and suppresses logging during dry-run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Adam Martin <adam.martin@ranchergovernment.com>
Member
|
old behavior... zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store sync --products kubewarden=kubewarden-controller-5.11.1
2026-04-09 02:09:11 WRN !!! WARNING !!! [--products] will be updating its default registry in a future release.
2026-04-09 02:09:11 INF processing product manifest for [kubewarden=kubewarden-controller-5.11.1] to store [/Users/zackbradys/Documents/Coding/GitHub/hauler/store]
2026-04-09 02:09:11 INF fetching product manifest from [rgcrprod.azurecr.us/hauler/kubewarden-manifest.yaml:kubewarden-controller-5.11.1]
2026-04-09 02:09:11 INF adding image [rgcrprod.azurecr.us/hauler/kubewarden-manifest.yaml:kubewarden-controller-5.11.1] to the store
ççç2026-04-09 02:09:14 INF successfully added image [rgcrprod.azurecr.us/hauler/kubewarden-manifest.yaml:kubewarden-controller-5.11.1]
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler % hauler store ls
+----------------------------------------------------------------------------------+-------+-------------+----------+---------+
| REFERENCE | TYPE | PLATFORM | # LAYERS | SIZE |
+----------------------------------------------------------------------------------+-------+-------------+----------+---------+
| rgcrprod.azurecr.us/hauler/kubewarden-manifest.yaml:kubewarden-controller-5.11.1 | image | - | 1 | 975 B |
| rgcrprod.azurecr.us/kubewarden/audit-scanner:v1.33.1 | image | - | 1 | 289 B |
| | image | linux/amd64 | 3 | 31.9 MB |
| | image | linux/arm64 | 3 | 29.2 MB |
+----------------------------------------------------------------------------------+-------+-------------+----------+---------+
| TOTAL | 61.0 MB |
+----------------------------------------------------------------------------------+-------+-------------+----------+---------+
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler % hauler store extract rgcrprod.azurecr.us/hauler/kubewarden-manifest.yaml:kubewarden-controller-5.11.1
2026-04-09 02:09:36 INF extracted [application/vnd.oci.image.manifest.v1+json] from store with digest [sha256:62a3d79e937ad57db4f6abae59b7232050181d6ab50956b9ce0ed357b5a32d51]
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler %
zackbradys@Zacks-MacBook-Pro hauler % cat kubewarden-manifest.yaml
apiVersion: content.hauler.cattle.io/v1
kind: Images
metadata:
name: carbide-kubewarden-images
spec:
images:
- name: rgcrprod.azurecr.us/kubewarden/audit-scanner:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/kubewarden-controller:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/policy-server:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/policies/allow-privilege-escalation-psp:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/capabilities-psp:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/host-namespaces-psp:v1.1.8
- name: rgcrprod.azurecr.us/kubewarden/policies/hostpaths-psp:v1.1.7
- name: rgcrprod.azurecr.us/kubewarden/policies/pod-privileged:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/user-group-psp:v1.1.5
- name: rgcrprod.azurecr.us/kyverno/policy-reporter-ui:2.5.1
- name: rgcrprod.azurecr.us/kyverno/policy-reporter:3.7.3
- name: rgcrprod.azurecr.us/rancher/kuberlr-kubectl:v8.0.0new behavior... zackbradys@Zacks-MacBook-Pro hauler % ./dist/hauler_darwin_arm64_v8.0/hauler store sync --products kubewarden=kubewarden-controller-5.11.1 --dry-run
---
apiVersion: content.hauler.cattle.io/v1
kind: Images
metadata:
name: carbide-kubewarden-images
spec:
images:
- name: rgcrprod.azurecr.us/kubewarden/audit-scanner:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/kubewarden-controller:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/policy-server:v1.33.1
- name: rgcrprod.azurecr.us/kubewarden/policies/allow-privilege-escalation-psp:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/capabilities-psp:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/host-namespaces-psp:v1.1.8
- name: rgcrprod.azurecr.us/kubewarden/policies/hostpaths-psp:v1.1.7
- name: rgcrprod.azurecr.us/kubewarden/policies/pod-privileged:v1.0.10
- name: rgcrprod.azurecr.us/kubewarden/policies/user-group-psp:v1.1.5
- name: rgcrprod.azurecr.us/kyverno/policy-reporter-ui:2.5.1
- name: rgcrprod.azurecr.us/kyverno/policy-reporter:3.7.3
- name: rgcrprod.azurecr.us/rancher/kuberlr-kubectl:v8.0.0 |
zackbradys
requested changes
Apr 9, 2026
zackbradys
approved these changes
Apr 9, 2026
Member
|
/cherrypick-2.0 |
|
✅ Backport PR created: #562 |
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.
Please check below, if the PR fulfills these requirements:
Associated Links:
Types of Changes:
Proposed Changes:
--dry-runflag tohauler store sync --productsSummary
--dry-runflag that outputs the product manifest YAML to stdout instead of syncing all referenced artifacts, allowing users to inspect manifest contents before committing to a full syncUsage
Inspect a product manifest before syncing
hauler store sync --products rancher=v2.10.1 --dry-runSave to a file for review or customization
hauler store sync --products rancher=v2.10.1 --dry-run > rancher-manifest.yamlMultiple products
hauler store sync --products rancher=v2.10.1,rke2=v1.31.5+rke2r1 --dry-runVerification/Testing of Changes:
--dry-runwith valid product prints manifest YAML to stdout--dry-runwithout--productsreturns a clear error--dry-rundoes not write to the OCI store or extract files to disk--dry-run, existing sync behavior is unchangedmake fmt,make vet,make testall passAdditional Context: