diff --git a/src/pkg/lint/lint_test.go b/src/pkg/lint/lint_test.go index 06169c7811..d1702be3d7 100644 --- a/src/pkg/lint/lint_test.go +++ b/src/pkg/lint/lint_test.go @@ -103,6 +103,7 @@ func TestLintPackageWithImports(t *testing.T) { } ctx := context.Background() findings := []PackageFinding{ + // unset exists in both the root and imported package { YqPath: "", Description: "package template UNSET is not set and won't be evaluated during lint", @@ -111,68 +112,28 @@ func TestLintPackageWithImports(t *testing.T) { PackagePathOverride: "linted-import", Severity: SevWarn, }, - { - YqPath: ".components.[0].images.[0]", - Description: "Image not pinned with digest", - Item: "ghcr.io/zarf-dev/doom-game:0.0.1", - PackageNameOverride: "dos-games", - PackagePathOverride: "oci://ghcr.io/zarf-dev/packages/dos-games:1.1.0", - Severity: SevWarn, - }, - { - YqPath: ".components.[1].images.[0]", - Description: "Image not pinned with digest", - Item: "registry.com:9001/whatever/image:latest", - PackageNameOverride: "linted-import", - PackagePathOverride: "linted-import", - Severity: SevWarn, - }, - { - YqPath: ".components.[1].images.[2]", - Description: "Image not pinned with digest", - Item: "busybox:latest", - PackageNameOverride: "linted-import", - PackagePathOverride: "linted-import", - Severity: SevWarn, - }, { YqPath: "", - Description: "package template UBUNTU_IMAGE is not set and won't be evaluated during lint", + Description: "package template UNSET is not set and won't be evaluated during lint", Item: "", PackageNameOverride: "lint", PackagePathOverride: ".", Severity: SevWarn, }, { - YqPath: ".components.[1].repos.[0]", - Description: "Unpinned repository", - Item: "https://github.com/zarf-dev/zarf-public-test.git", - PackageNameOverride: "lint", - PackagePathOverride: ".", - Severity: SevWarn, - }, - { - YqPath: ".components.[1].repos.[2]", - Description: "Unpinned repository", - Item: "https://gitlab.com/gitlab-org/build/omnibus-mirror/pcre2/-/tree/vreverse?ref_type=heads", - PackageNameOverride: "lint", - PackagePathOverride: ".", - Severity: SevWarn, - }, - { - YqPath: ".components.[1].images.[0]", + YqPath: ".components.[0].images.[0]", Description: "Image not pinned with digest", - Item: "registry.com:9001/whatever/image:1.0.0", - PackageNameOverride: "lint", - PackagePathOverride: ".", + Item: "ghcr.io/zarf-dev/doom-game:0.0.1", + PackageNameOverride: "dos-games", + PackagePathOverride: "oci://ghcr.io/zarf-dev/packages/dos-games:1.1.0", Severity: SevWarn, }, { - YqPath: ".components.[1].images.[2]", + YqPath: ".components.[1].images.[0]", Description: "Image not pinned with digest", Item: "busybox:latest", - PackageNameOverride: "lint", - PackagePathOverride: ".", + PackageNameOverride: "linted-import", + PackagePathOverride: "linted-import", Severity: SevWarn, }, { diff --git a/src/pkg/lint/testdata/lint-with-imports/linted-import/zarf.yaml b/src/pkg/lint/testdata/lint-with-imports/linted-import/zarf.yaml index d4a190f9e6..ed205ca622 100644 --- a/src/pkg/lint/testdata/lint-with-imports/linted-import/zarf.yaml +++ b/src/pkg/lint/testdata/lint-with-imports/linted-import/zarf.yaml @@ -9,12 +9,13 @@ variables: components: - name: dont-care + images: + - image-that-should-not-show-up-in-lint:unpinned - name: import-test images: - - registry.com:9001/whatever/image:latest - - busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79 - busybox:###ZARF_PKG_TMPL_BUSYBOX_IMAGE### + - busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79 - busybox:###ZARF_PKG_TMPL_UNSET### - name: oci-games-url diff --git a/src/pkg/lint/testdata/lint-with-imports/zarf.yaml b/src/pkg/lint/testdata/lint-with-imports/zarf.yaml index 6f75f68517..1e646e652c 100644 --- a/src/pkg/lint/testdata/lint-with-imports/zarf.yaml +++ b/src/pkg/lint/testdata/lint-with-imports/zarf.yaml @@ -8,21 +8,9 @@ components: path: linted-import - name: full-repo - repos: - - https://github.com/zarf-dev/zarf-public-test.git - - https://dev.azure.com/defenseunicorns/zarf-public-test/_git/zarf-public-test@v0.0.1 - - https://gitlab.com/gitlab-org/build/omnibus-mirror/pcre2/-/tree/vreverse?ref_type=heads images: - - registry.com:9001/whatever/image:1.0.0 - busybox@sha256:3fbc632167424a6d997e74f52b878d7cc478225cffac6bc977eedfe51c7f4e79 - - busybox:###ZARF_PKG_TMPL_BUSYBOX_IMAGE### - - ubuntu:###ZARF_PKG_TMPL_UBUNTU_IMAGE### - files: - - source: https://github.com/k3s-io/k3s/releases/download/v1.28.2+k3s1/k3s - shasum: 2f041d37a2c6d54d53e106e1c7713bc48f806f3919b0d9e092f5fcbdc55b41cf - target: src/ - - source: file-without-shasum.txt - target: src/ + - busybox:###ZARF_PKG_TMPL_UNSET### - name: oci-games-url import: