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

fix: add support for zarf dev lint #436

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
22 changes: 22 additions & 0 deletions src/test/e2e/zarf_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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")
}
Loading