Skip to content

Commit

Permalink
Add rego V1 build flag (#162)
Browse files Browse the repository at this point in the history
* Add rego-version build flag

* upd cmd help string

---------

Co-authored-by: Gert Drapers <gert.drapers@live.com>
  • Loading branch information
carabasdaniel and gertd authored Feb 6, 2024
1 parent 956aade commit 2e5359b
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 31 deletions.
7 changes: 7 additions & 0 deletions cmd/policy/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ type BuildCmd struct {
ExcludeVerifyFiles []string `name:"exclude-files-verify" help:"Set file names to exclude during bundle verification."`
SigningKey string `name:"signing-key" help:"Set the secret (HMAC) or path of the PEM file containing the private key (RSA and ECDSA)."`
ClaimsFile string `name:"claims-file" help:"Set path of JSON file containing optional claims (see: https://openpolicyagent.org/docs/latest/management/#signature-format)."`
RegoVersion string `name:"rego-version" enum:"default,rego.v1" default:"default" help:"Set rego version flag (enum: default or rego.v1)."`
}

func (c *BuildCmd) Run(g *Globals) error {
v1build := false
if c.RegoVersion == "rego.v1" {
v1build = true
}

err := g.App.Build(
c.Tag,
c.Path,
Expand All @@ -44,6 +50,7 @@ func (c *BuildCmd) Run(g *Globals) error {
c.ExcludeVerifyFiles,
c.SigningKey,
c.ClaimsFile,
v1build,
)
if err != nil {
return perr.BuildFailed.WithError(err)
Expand Down
63 changes: 33 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ require (
github.com/aserto-dev/certs v0.0.3
github.com/aserto-dev/clui v0.8.3
github.com/aserto-dev/logger v0.0.4
github.com/aserto-dev/runtime v0.58.0
github.com/aserto-dev/runtime v0.60.0
github.com/aserto-dev/scc-lib v0.1.2
github.com/containerd/containerd v1.7.7
github.com/containerd/containerd v1.7.11
github.com/docker/cli v23.0.3+incompatible
github.com/dustin/go-humanize v1.0.0
github.com/google/wire v0.5.0
Expand All @@ -19,23 +19,23 @@ require (
github.com/opcr-io/oras-go/v2 v2.0.0-20231122155130-eb4260d8a0ae
github.com/opcr-io/policy/oci v0.2.5-0.20231122153628-152ef46de97b
github.com/opcr-io/policy/parser v0.2.5-0.20231122153628-152ef46de97b
github.com/open-policy-agent/opa v0.58.0
github.com/open-policy-agent/opa v0.60.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0-rc5
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.29.1
github.com/rs/zerolog v1.31.0
github.com/spf13/viper v1.14.0
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.4.0
golang.org/x/term v0.13.0
golang.org/x/sync v0.6.0
golang.org/x/term v0.16.0
sigs.k8s.io/controller-runtime v0.14.1
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/hcsshim v0.11.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -46,27 +46,29 @@ require (
github.com/docker/docker v23.0.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/subcommands v1.2.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/kyokomi/emoji v2.2.4+incompatible // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
Expand All @@ -75,10 +77,10 @@ require (
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/peterh/liner v1.2.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
Expand All @@ -91,20 +93,21 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.11.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 2e5359b

Please sign in to comment.