Skip to content

Commit

Permalink
fix: add support for zarf dev lint (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Feb 16, 2024
1 parent 0ee74f4 commit b95f305
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
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")
}

0 comments on commit b95f305

Please sign in to comment.