From ae8f9fb296eb1ddde10cf8a9f7d7dfafe78403df Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Fri, 16 Feb 2024 11:33:40 -0700 Subject: [PATCH 1/3] fix: add support for zarf dev lint --- main.go | 11 ++++++++++- src/test/e2e/zarf_test.go | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/test/e2e/zarf_test.go diff --git a/main.go b/main.go index bd0ec340..255515f3 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,17 @@ // Package main is the entrypoint for the uds binary. package main -import "github.com/defenseunicorns/uds-cli/src/cmd" +import ( + "embed" + + "github.com/defenseunicorns/uds-cli/src/cmd" + "github.com/defenseunicorns/zarf/src/pkg/packager/lint" +) + +//go:embed zarf.schema.json +var zarfSchema embed.FS func main() { + lint.ZarfSchema = zarfSchema cmd.Execute() } diff --git a/src/test/e2e/zarf_test.go b/src/test/e2e/zarf_test.go new file mode 100644 index 00000000..7fa20c7f --- /dev/null +++ b/src/test/e2e/zarf_test.go @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2023-Present The UDS Authors + +// Package test provides e2e tests for UDS. +package test + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +// NOTE: These tests test that the embedded `zarf` commands are imported properly and function as expected + +// TestZarfLint tests to ensure that the `zarf dev lint` command functions (which requires the zarf schema to be embedded in main.go) + +func TestZarfLint(t *testing.T) { + cmd := strings.Split("zarf dev lint src/test/packages/podinfo", " ") + _, stdErr, err := e2e.UDS(cmd...) + require.NoError(t, err) + require.Contains(t, stdErr, "Image not pinned with digest - ghcr.io/stefanprodan/podinfo:6.4.0") +} From 31e7e7580c2149c2ce3291a8b24bdc795e35d79d Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Fri, 16 Feb 2024 11:35:03 -0700 Subject: [PATCH 2/3] fix spacing --- src/test/e2e/zarf_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/e2e/zarf_test.go b/src/test/e2e/zarf_test.go index 7fa20c7f..c5807505 100644 --- a/src/test/e2e/zarf_test.go +++ b/src/test/e2e/zarf_test.go @@ -14,7 +14,6 @@ import ( // NOTE: These tests test that the embedded `zarf` commands are imported properly and function as expected // TestZarfLint tests to ensure that the `zarf dev lint` command functions (which requires the zarf schema to be embedded in main.go) - func TestZarfLint(t *testing.T) { cmd := strings.Split("zarf dev lint src/test/packages/podinfo", " ") _, stdErr, err := e2e.UDS(cmd...) From d59ca7bfeb73579f2a1f602cef38098b79065a53 Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Fri, 16 Feb 2024 11:38:43 -0700 Subject: [PATCH 3/3] fix pull request template --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5074bff0..5cf25563 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,4 +17,4 @@ Relates to # ## Checklist before merging - [ ] Test, docs, adr added or updated as needed -- [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-cli/blob/main/CONTRIBUTING.md)(https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md#submitting-a-pull-request) followed +- [ ] [Contributor Guide Steps](https://github.com/defenseunicorns/uds-cli/blob/main/CONTRIBUTING.md) followed