Skip to content
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

Add --update flag to zarf dev find-images #3296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xyzzyz
Copy link

@xyzzyz xyzzyz commented Dec 6, 2024

Description

Currently, zarf dev find-images just lists the changes needed to be made to zarf.yaml. This PR adds --update flag
that actually executes the change: it replaces the images: list in each of the components with the result of find-images. Care is taken to operate on full YAML AST, so that no whitespace or comments in zarf.yaml are affected.

Example:

amichalik@amichalik-5680-ubuntu:~/work/zarf/examples/argocd$ git status .
On branch amichalik/find-images-update
Your branch is up to date with 'xyzzyz/amichalik/find-images-update'.

nothing to commit, working tree clean
amichalik@amichalik-5680-ubuntu:~/work/zarf/examples/argocd$ ../../build/zarf dev find-images --update 

<snip...>

components:

  - name: argocd-helm-chart
    images:
      - docker.io/library/redis:7.0.15-alpine
      - quay.io/argoproj/argocd:v2.9.6
      # Cosign artifacts for images - argocd - argocd-helm-chart
      - quay.io/argoproj/argocd:sha256-2dafd800fb617ba5b16ae429e388ca140f66f88171463d23d158b372bb2fae08.sig
      - quay.io/argoproj/argocd:sha256-2dafd800fb617ba5b16ae429e388ca140f66f88171463d23d158b372bb2fae08.att

amichalik@amichalik-5680-ubuntu:~/work/zarf/examples/argocd$ git status .
On branch amichalik/find-images-update
Your branch is up to date with 'xyzzyz/amichalik/find-images-update'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   zarf.yaml

no changes added to commit (use "git add" and/or "git commit -a")
amichalik@amichalik-5680-ubuntu:~/work/zarf/examples/argocd$ git diff .
diff --git a/examples/argocd/zarf.yaml b/examples/argocd/zarf.yaml
index 8c548465..7fa6dbbd 100644
--- a/examples/argocd/zarf.yaml
+++ b/examples/argocd/zarf.yaml
@@ -16,10 +16,9 @@ components:
           - baseline/values.yaml
     images:
       - docker.io/library/redis:7.0.15-alpine
-      - quay.io/argoproj/argocd:v2.9.6
-      # Cosign artifacts for images - argocd - argocd-helm-chart
-      - quay.io/argoproj/argocd:sha256-2dafd800fb617ba5b16ae429e388ca140f66f88171463d23d158b372bb2fae08.sig
       - quay.io/argoproj/argocd:sha256-2dafd800fb617ba5b16ae429e388ca140f66f88171463d23d158b372bb2fae08.att
+      - quay.io/argoproj/argocd:sha256-2dafd800fb617ba5b16ae429e388ca140f66f88171463d23d158b372bb2fae08.sig
+      - quay.io/argoproj/argocd:v2.9.6
   - name: argocd-apps
     required: true
     charts:

Observe that the rest of zarf.yaml is completely unchanged.

Related Issue

Fixes #

Relates to #

Checklist before merging

@xyzzyz xyzzyz requested review from a team as code owners December 6, 2024 00:25
Copy link

netlify bot commented Dec 6, 2024

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit d970966
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/67524477b007f80008190d09

@phillebaba
Copy link
Member

I stated this in #3236 also that we are currently doing work to refactor the packager package which includes find images. It would be great if you could great an issue first so that we could discuss the design of this first. Thank you 💯

@xyzzyz
Copy link
Author

xyzzyz commented Dec 10, 2024

Apparently there's already #2865

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.

2 participants