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

chore(deps): update module github.com/defenseunicorns/go-oscal to v0.5.0 #492

Merged
merged 4 commits into from
Jun 20, 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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/defenseunicorns/lula
go 1.22.3

require (
github.com/defenseunicorns/go-oscal v0.4.3
github.com/defenseunicorns/go-oscal v0.5.0
github.com/hashicorp/go-version v1.7.0
github.com/kyverno/kyverno-json v0.0.3
github.com/open-policy-agent/opa v0.65.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/daviddengcn/go-colortext v1.0.0 h1:ANqDyC0ys6qCSvuEK7l3g5RaehL/Xck9EX8ATG8oKsE=
github.com/daviddengcn/go-colortext v1.0.0/go.mod h1:zDqEI5NVUop5QPpVJUxE9UO10hRnmkD5G4Pmri9+m4c=
github.com/defenseunicorns/go-oscal v0.4.3 h1:Emt4zozFyJLklXaEva+BSgLOYvEsXQk+UC8CWBzEEyM=
github.com/defenseunicorns/go-oscal v0.4.3/go.mod h1:+t07tyboxeaRUa7i32TeySwZjVGVsi8Ob+JZRIlHZZA=
github.com/defenseunicorns/go-oscal v0.5.0 h1:rZzq5Rg+jtN7lRcUvoZBrx0efr5RQAF/3rD9c217d+U=
github.com/defenseunicorns/go-oscal v0.5.0/go.mod h1:+t07tyboxeaRUa7i32TeySwZjVGVsi8Ob+JZRIlHZZA=
github.com/dgraph-io/badger/v3 v3.2103.5 h1:ylPa6qzbjYRQMU6jokoj4wzcaweHylt//CH0AKt0akg=
github.com/dgraph-io/badger/v3 v3.2103.5/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw=
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
Expand Down
14 changes: 13 additions & 1 deletion src/cmd/tools/lint.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package tools

import (
"encoding/json"

"github.com/defenseunicorns/go-oscal/src/pkg/validation"
"github.com/defenseunicorns/lula/src/config"
"github.com/defenseunicorns/lula/src/pkg/message"
Expand Down Expand Up @@ -33,16 +35,26 @@ func init() {
defer spinner.Stop()

validationResp, err := validation.ValidationCommand(opts.InputFile)
// fatal for non-validation errors
if err != nil {
message.Fatalf(err, "Failed to lint %s: %s", opts.InputFile, err)
}

for _, warning := range validationResp.Warnings {
message.Warn(warning)
}

if opts.ResultFile != "" {
validation.WriteValidationResult(validationResp.Result, opts.ResultFile)
} else {
jsonBytes, err := json.MarshalIndent(validationResp.Result, "", " ")
if err != nil {
message.Fatalf(err, "Failed to marshal validation result")
}
message.Infof("Validation result: %s", string(jsonBytes))
}

if err != nil {
if validationResp.JsonSchemaError != nil {
message.Fatalf(err, "Failed to lint %s", opts.InputFile)
}
message.Infof("Successfully validated %s is valid OSCAL version %s %s\n", opts.InputFile, validationResp.Validator.GetSchemaVersion(), validationResp.Validator.GetModelType())
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/pod_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func validatePodLabelPass(ctx context.Context, t *testing.T, config *envconf.Con
}

validatorResponse, err := validation.ValidationCommand("sar-test.yaml")
if err != nil {
if err != nil || validatorResponse.JsonSchemaError != nil {
t.Fatal("File failed linting")
}
message.Infof("Successfully validated %s is valid OSCAL version %s %s\n", "sar-test.yaml", validatorResponse.Validator.GetSchemaVersion(), validatorResponse.Validator.GetModelType())
Expand Down