From eb9b69dd3d710cb7afa1dfb6e23a5987842b21cc Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Tue, 6 Mar 2018 20:31:58 -0800 Subject: Allow for configuration policies Summary: Implements a rough interface for validating configuration against arbitrary policy rules. Policies are provided as YAML and passed via the command line as file paths or remote URIs. The format of policies is: enforcements: - path: rule: Where `` is a YAML-ish path to a config field and `` is any expression our config validator understands (expressions built in by the validator library and custom tags defined in `config.validation.go`). Example policy: enforcements: - path: variants.production.base rule: oneof=debian:jessie debian:stretch - path: variants.production.runs.as rule: ne=foo - path: variants.production.node.dependencies rule: isfalse Command flag parsing was implemented in `main.go` to support the new `--policy=uri` flag and improve existing handling of `--version` and the usage statement. Test Plan: Run `go test ./...`. Reviewers: thcipriani, demon, hashar, mmodell, #release-engineering-team Reviewed By: thcipriani, #release-engineering-team Tags: #release-engineering-team Differential Revision: https://phabricator.wikimedia.org/D999 --- Gopkg.lock | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Gopkg.lock') diff --git a/Gopkg.lock b/Gopkg.lock index 8a4aeee..65b35a4 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -25,6 +25,12 @@ revision = "b32fa301c9fe55953584134cb6853a13c87ec0a1" version = "v0.16.0" +[[projects]] + branch = "v2" + name = "github.com/pborman/getopt" + packages = ["v2"] + revision = "0fd4e972e7f7285fbae5863470524ece4ae99d78" + [[projects]] name = "github.com/pmezard/go-difflib" packages = ["difflib"] @@ -37,11 +43,17 @@ revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" version = "v1.1.4" +[[projects]] + name = "github.com/utahta/go-openuri" + packages = ["."] + revision = "e3e1c475535dd7256d67286b1c8c223721aafa05" + version = "v0.1.0" + [[projects]] name = "gopkg.in/go-playground/validator.v9" packages = ["."] - revision = "61caf9d3038e1af346dbf5c2e16f6678e1548364" - version = "v9.9.0" + revision = "1b8c8e19cd250435025214492d9a08411d760fdd" + version = "v9.12.0" [[projects]] branch = "v2" @@ -52,6 +64,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "a207dfcd5255a9f7ed6e08d3982f8f3075d29d45b7d0bb7ad31709e04755a649" + inputs-digest = "8cdb40365412638a73ba10e3c82296098a85b4df74a25186aec4bd7b3a8c50e4" solver-name = "gps-cdcl" solver-version = 1 -- cgit v1.2.1