From e9e87b0a19281783c5869a99f7f5406b0b28649b Mon Sep 17 00:00:00 2001 From: Yingrong Zhao Date: Fri, 10 Jun 2022 10:01:04 -0400 Subject: [PATCH 01/23] Use user specified directory for resolving file path (#2142) * use user specified build directory if provided for porter manifest Signed-off-by: Yingrong Zhao * update tests Signed-off-by: Yingrong Zhao * update doc and fix tests Signed-off-by: Yingrong Zhao * address comment Signed-off-by: Yingrong Zhao * explicitly set default value for o.Dir Signed-off-by: Yingrong Zhao * clearer help text Signed-off-by: Yingrong Zhao Signed-off-by: joshuabezaleel --- cmd/porter/bundle.go | 4 ++-- pkg/manifest/manifest.go | 4 ++++ pkg/porter/build.go | 9 ++++++-- pkg/porter/cnab.go | 45 ++++++++++++++++++++-------------------- pkg/porter/cnab_test.go | 19 ++++++++++------- 5 files changed, 48 insertions(+), 33 deletions(-) diff --git a/cmd/porter/bundle.go b/cmd/porter/bundle.go index df01d4097..f2cbf0e65 100644 --- a/cmd/porter/bundle.go +++ b/cmd/porter/bundle.go @@ -80,9 +80,9 @@ The docker driver builds the bundle image using the local Docker host. To use a f.StringVar(&opts.Name, "name", "", "Override the bundle name") f.StringVar(&opts.Version, "version", "", "Override the bundle version") f.StringVarP(&opts.File, "file", "f", "", - "Path to the Porter manifest. Defaults to `porter.yaml` in the current directory.") + "Path to the Porter manifest. The path is relative to the build context directory. Defaults to porter.yaml in the current directory.") f.StringVarP(&opts.Dir, "dir", "d", "", - "Path to the build context directory where all bundle assets are located.") + "Path to the build context directory where all bundle assets are located. Defaults to the current directory.") f.StringVar(&opts.Driver, "driver", porter.BuildDriverDefault, fmt.Sprintf("Driver for building the invocation image. Allowed values are: %s", strings.Join(porter.BuildDriverAllowedValues, ", "))) f.MarkHidden("driver") // Hide the driver flag since there aren't any choices to make right now diff --git a/pkg/manifest/manifest.go b/pkg/manifest/manifest.go index 8321aa45e..732246041 100644 --- a/pkg/manifest/manifest.go +++ b/pkg/manifest/manifest.go @@ -17,6 +17,7 @@ import ( "get.porter.sh/porter/pkg/config" "get.porter.sh/porter/pkg/portercontext" "get.porter.sh/porter/pkg/schema" + "get.porter.sh/porter/pkg/tracing" "get.porter.sh/porter/pkg/yaml" "github.com/Masterminds/semver/v3" "github.com/cbroglie/mustache" @@ -1052,6 +1053,9 @@ func scanManifestTemplating(data []byte) (templateScanResult, error) { // LoadManifestFrom reads and validates the manifest at the specified location, // and returns a populated Manifest structure. func LoadManifestFrom(ctx context.Context, config *config.Config, file string) (*Manifest, error) { + ctx, log := tracing.StartSpan(ctx) + defer log.EndSpan() + m, err := ReadManifest(config.Context, file) if err != nil { return nil, err diff --git a/pkg/porter/build.go b/pkg/porter/build.go index e29754b4a..75979b41b 100644 --- a/pkg/porter/build.go +++ b/pkg/porter/build.go @@ -14,6 +14,7 @@ import ( "get.porter.sh/porter/pkg/mixin" "get.porter.sh/porter/pkg/printer" "get.porter.sh/porter/pkg/storage" + "get.porter.sh/porter/pkg/tracing" "github.com/Masterminds/semver/v3" "github.com/opencontainers/go-digest" "github.com/pkg/errors" @@ -92,6 +93,9 @@ func (o *BuildOptions) parseCustomInputs() error { } func (p *Porter) Build(ctx context.Context, opts BuildOptions) error { + ctx, log := tracing.StartSpan(ctx) + defer log.EndSpan() + opts.Apply(p.Context) if p.Debug { @@ -120,7 +124,7 @@ func (p *Porter) Build(ctx context.Context, opts BuildOptions) error { m.ManifestPath = opts.File if !opts.NoLint { - if err := p.preLint(ctx); err != nil { + if err := p.preLint(ctx, opts.File); err != nil { return err } } @@ -148,10 +152,11 @@ func (p *Porter) Build(ctx context.Context, opts BuildOptions) error { return errors.Wrap(builder.BuildInvocationImage(ctx, m, opts.BuildImageOptions), "unable to build CNAB invocation image") } -func (p *Porter) preLint(ctx context.Context) error { +func (p *Porter) preLint(ctx context.Context, file string) error { lintOpts := LintOptions{ contextOptions: NewContextOptions(p.Context), PrintOptions: printer.PrintOptions{}, + File: file, } lintOpts.RawFormat = string(printer.FormatPlaintext) err := lintOpts.Validate(p.Context) diff --git a/pkg/porter/cnab.go b/pkg/porter/cnab.go index bd41e264b..5cf2bfec5 100644 --- a/pkg/porter/cnab.go +++ b/pkg/porter/cnab.go @@ -46,19 +46,10 @@ type bundleFileOptions struct { func (o *bundleFileOptions) Validate(cxt *portercontext.Context) error { var err error - err = o.validateBundleFiles(cxt) - if err != nil { - return err - } - if o.ReferenceSet { return nil } - if o.File != "" { - o.File = cxt.FileSystem.Abs(o.File) - } - // Resolve the proper build context directory if o.Dir != "" { _, err = cxt.FileSystem.IsDir(o.Dir) @@ -66,6 +57,22 @@ func (o *bundleFileOptions) Validate(cxt *portercontext.Context) error { return errors.Wrapf(err, "%q is not a valid directory", o.Dir) } o.Dir = cxt.FileSystem.Abs(o.Dir) + } else { + // default to current working directory + o.Dir = cxt.Getwd() + } + + if o.File != "" { + if !filepath.IsAbs(o.File) { + o.File = cxt.FileSystem.Abs(filepath.Join(o.Dir, o.File)) + } else { + o.File = cxt.FileSystem.Abs(o.File) + } + } + + err = o.validateBundleFiles(cxt) + if err != nil { + return err } err = o.defaultBundleFiles(cxt) @@ -164,27 +171,21 @@ func (o *bundleFileOptions) defaultBundleFiles(cxt *portercontext.Context) error } else if o.CNABFile != "" { // --cnab-file // Nothing to default } else { - manifestExists, err := cxt.FileSystem.Exists(config.Name) - if err != nil { - return errors.Wrap(err, "could not check if porter manifest exists in current directory") + defaultPath := filepath.Join(o.Dir, config.Name) + manifestExists, err := cxt.FileSystem.Exists(defaultPath) + if err != nil || !manifestExists { + return errors.Wrapf(err, "could not find a porter manifest at %s", defaultPath) } - if manifestExists { - o.File = config.Name - o.defaultCNABFile() - } + o.File = defaultPath + o.defaultCNABFile() } return nil } func (o *bundleFileOptions) defaultCNABFile() { - // Place the bundle.json in o.Dir if set; otherwise place in current directory - if o.Dir != "" { - o.CNABFile = filepath.Join(o.Dir, build.LOCAL_BUNDLE) - } else { - o.CNABFile = build.LOCAL_BUNDLE - } + o.CNABFile = filepath.Join(o.Dir, build.LOCAL_BUNDLE) } func (o *bundleFileOptions) validateBundleFiles(cxt *portercontext.Context) error { diff --git a/pkg/porter/cnab_test.go b/pkg/porter/cnab_test.go index db03c7011..83d8361c5 100644 --- a/pkg/porter/cnab_test.go +++ b/pkg/porter/cnab_test.go @@ -2,6 +2,7 @@ package porter import ( "context" + "path/filepath" "testing" "get.porter.sh/porter/pkg" @@ -260,8 +261,8 @@ func Test_bundleFileOptions(t *testing.T) { name: "no opts", opts: bundleFileOptions{}, setup: func(ctx *portercontext.Context, opts bundleFileOptions) error { return nil }, - wantFile: config.Name, - wantCNABFile: build.LOCAL_BUNDLE, + wantFile: "/" + config.Name, + wantCNABFile: "/" + build.LOCAL_BUNDLE, wantError: "", }, { name: "reference set", @@ -289,16 +290,20 @@ func Test_bundleFileOptions(t *testing.T) { setup: func(ctx *portercontext.Context, opts bundleFileOptions) error { return nil }, wantFile: "", wantCNABFile: "", - wantError: "unable to access --file alternate/porter.yaml: open /alternate/porter.yaml: file does not exist", + wantError: "unable to access --file /alternate/porter.yaml: open /alternate/porter.yaml: file does not exist", }, { name: "valid dir", opts: bundleFileOptions{ Dir: "path/to/bundle", }, setup: func(ctx *portercontext.Context, opts bundleFileOptions) error { + err := ctx.FileSystem.MkdirAll(filepath.Join(opts.Dir, config.Name), pkg.FileModeDirectory) + if err != nil { + return err + } return ctx.FileSystem.MkdirAll(opts.Dir, pkg.FileModeDirectory) }, - wantFile: config.Name, + wantFile: "/path/to/bundle/porter.yaml", wantCNABFile: "/path/to/bundle/.cnab/bundle.json", wantError: "", }, { @@ -310,7 +315,7 @@ func Test_bundleFileOptions(t *testing.T) { return ctx.FileSystem.MkdirAll(opts.File, pkg.FileModeDirectory) }, wantFile: "/alternate/porter.yaml", - wantCNABFile: build.LOCAL_BUNDLE, + wantCNABFile: "/" + build.LOCAL_BUNDLE, wantError: "", }, { name: "valid dir and file", @@ -319,13 +324,13 @@ func Test_bundleFileOptions(t *testing.T) { File: "alternate/porter.yaml", }, setup: func(ctx *portercontext.Context, opts bundleFileOptions) error { - err := ctx.FileSystem.MkdirAll(opts.File, pkg.FileModeDirectory) + err := ctx.FileSystem.MkdirAll(filepath.Join(opts.Dir, opts.File), pkg.FileModeDirectory) if err != nil { return err } return ctx.FileSystem.MkdirAll(opts.Dir, pkg.FileModeDirectory) }, - wantFile: "/alternate/porter.yaml", + wantFile: "/path/to/bundle/alternate/porter.yaml", wantCNABFile: "/path/to/bundle/.cnab/bundle.json", wantError: "", }} From 7faa23f0d210030d40af6253817ecf64943b55a5 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Thu, 9 Jun 2022 14:20:53 -0500 Subject: [PATCH 02/23] Update to helm3 mixin v0.1.16 v0.1.16 includes fixes for using nonroot invocation images Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel --- magefile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magefile.go b/magefile.go index c503231c1..c1c575eef 100644 --- a/magefile.go +++ b/magefile.go @@ -149,7 +149,7 @@ func GetMixins() error { {name: "arm"}, {name: "terraform"}, {name: "kubernetes"}, - {name: "helm3", feed: "https://mchorfa.github.io/porter-helm3/atom.xml", version: "v0.1.14"}, + {name: "helm3", feed: "https://mchorfa.github.io/porter-helm3/atom.xml", version: "v0.1.16"}, } var errG errgroup.Group for _, mixin := range mixins { From 4b40a1df963785b4421948eed90bffc04c941e2c Mon Sep 17 00:00:00 2001 From: Yingrong Zhao Date: Wed, 15 Jun 2022 16:41:29 -0400 Subject: [PATCH 03/23] Sanitize archive folder name (#2154) * fix archive folder creation Signed-off-by: Yingrong Zhao * replace path separator instead Signed-off-by: Yingrong Zhao * modify test Signed-off-by: Yingrong Zhao Signed-off-by: joshuabezaleel --- go.sum | 2 -- pkg/porter/archive.go | 27 +++++++++++++++++++++------ pkg/porter/archive_test.go | 16 ++++++++++++++++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/go.sum b/go.sum index da0ea075e..3103dce3b 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,6 @@ contrib.go.opencensus.io/exporter/stackdriver v0.12.1/go.mod h1:iwB6wGarfphGGe/e contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -get.porter.sh/magefiles v0.1.3 h1:91Y7vFDHGmMBbRfHQqEcIlqpp/RfDCMhyHGVusTYlmE= -get.porter.sh/magefiles v0.1.3/go.mod h1:Whw/DSX8dcgn7dUPb6csbY6PtuTy1wujwFR2G6ONf20= get.porter.sh/magefiles v0.3.0 h1:uwCOTblBx2RFN2IEgIUDP4sNj/C4F26KqAdqSREJL7g= get.porter.sh/magefiles v0.3.0/go.mod h1:lwDECEEivbBHACLImnDEhwlr8g3E4xZR1W0DO8FOGa8= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= diff --git a/pkg/porter/archive.go b/pkg/porter/archive.go index ddaccd12d..35d64653f 100644 --- a/pkg/porter/archive.go +++ b/pkg/porter/archive.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "strings" "time" "get.porter.sh/porter/pkg" @@ -16,6 +17,7 @@ import ( "github.com/cnabio/cnab-go/imagestore/construction" "github.com/docker/docker/pkg/archive" "github.com/pkg/errors" + "github.com/spf13/afero" ) // ArchiveOptions defines the valid options for performing an archive operation @@ -88,14 +90,10 @@ type exporter struct { } func (ex *exporter) export() error { - name := ex.bundle.Name + "-" + ex.bundle.Version - archiveDir, err := ex.fs.TempDir("", name) + archiveDir, err := ex.createArchiveFolder(name) if err != nil { - return err - } - if err := ex.fs.MkdirAll(archiveDir, 0644); err != nil { - return err + return fmt.Errorf("can not create archive folder: %w", err) } defer ex.fs.RemoveAll(archiveDir) @@ -186,6 +184,23 @@ func (ex *exporter) addImage(image bundle.BaseImage) error { return checkDigest(image, dig) } +// createArchiveFolder set up a temporary directory for storing all data needed to archive a bundle. +// It sanitizes the name and make sure only the current user has full permission to it. +// If the name contains a path separator, all path separators will be replaced with "-". +func (ex *exporter) createArchiveFolder(name string) (string, error) { + cleanedPath := strings.ReplaceAll(afero.UnicodeSanitize(name), string(os.PathSeparator), "-") + archiveDir, err := ex.fs.TempDir("", cleanedPath) + if err != nil { + return "", fmt.Errorf("can not create a temporary archive folder: %w", err) + } + + err = ex.fs.Chmod(archiveDir, pkg.FileModeDirectory) + if err != nil { + return "", fmt.Errorf("can not change permission for the temporary archive folder: %w", err) + } + return archiveDir, nil +} + // checkDigest compares the content digest of the given image to the given content digest and returns an error if they // are both non-empty and do not match func checkDigest(image bundle.BaseImage, dig string) error { diff --git a/pkg/porter/archive_test.go b/pkg/porter/archive_test.go index 12905cbae..7c6d949af 100644 --- a/pkg/porter/archive_test.go +++ b/pkg/porter/archive_test.go @@ -4,6 +4,8 @@ import ( "context" "testing" + "get.porter.sh/porter/pkg" + "get.porter.sh/porter/tests" "github.com/stretchr/testify/require" ) @@ -51,3 +53,17 @@ func TestArchive_Validate(t *testing.T) { }) } } + +func TestArchive_ArchiveDirectory(t *testing.T) { + p := NewTestPorter(t) + defer p.Close() + ex := exporter{ + fs: p.FileSystem, + } + + dir, err := ex.createArchiveFolder("examples/test-bundle-0.2.0") + require.NoError(t, err) + require.Contains(t, dir, "/tmp/examples-test-bundle-0.2.0") + + tests.AssertDirectoryPermissionsEqual(t, dir, pkg.FileModeDirectory) +} From c8f32794c918afd83f1543f045f89f09497bf00a Mon Sep 17 00:00:00 2001 From: Joshua Bezaleel Abednego Date: Thu, 16 Jun 2022 04:20:24 +0700 Subject: [PATCH 04/23] Adding pagination for installation, parameter, and credential list result using skip and limit option (#2137) * Add pagination option for installation list command using skip and limit flag Signed-off-by: joshuabezaleel * Increase plugin start/stop timeouts As I was adding back in net/rpc plugins (the legacy v0 plugins), I realized that our plugin timeouts don't work well for net/rpc since it is much slower than gRPC. I've bumped both the plugin start and stop timeout defaults to make it less likely that a user will run into the timeout, while still giving us a good "oops the plugin is broken" timeout detection. Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel * Add InstallationStore.FindInstallations (#2119) The advanced dependencies proposal needs to be able to search for installations based on more complex critieria than is available in the ListInstallations function (which is intended to support the porter installation list command). FindInstallations lets us craft any valid mongodb find query and execute it, returning a list of installations. Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel * Rename DisplayRun.ClaimID to ID I missed this field when I did a sweep earlier to remove the use of the word claim in the release/v1 branch. In the rest of the CLI's output we call the run's id just ID or RunID, and should be consistent with that. I've changed DisplayID.ClaimID to ID so that we aren't exposing the term claim to our users (and it's not really the claim id anymore anyway). Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel * Support Docker TLS environment variables We are using the docker cli library to build images and I had thought this gave us automatic support for building against a remote docker host. It works fine for DOCKER_HOST, but turns out the TLS configuration environment variables are only parsed when the docker CLI flags are bound (which doesn't occur when we use it as a library). I've updated how we initialize the docker cli library so that DOCKER_TLS_VERIFY and DOCKER_CERT_PATH are picked up and passed to the library. Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel * Add vet and lint targets to magefile Signed-off-by: Tanmay Chaudhry Signed-off-by: joshuabezaleel * Add ListOption input parameter struct and enable skip and limit option to credential and parameter list command as well Signed-off-by: joshuabezaleel * Leave out default value for ListOption's properties Signed-off-by: joshuabezaleel * Remove commented function signature Signed-off-by: joshuabezaleel * Convert CreateListFilter to ToFindOptions method for ListOptions type receiver Signed-off-by: joshuabezaleel Co-authored-by: Carolyn Van Slyck Co-authored-by: Tanmay Chaudhry Signed-off-by: joshuabezaleel --- cmd/porter/credentials.go | 7 +++- cmd/porter/installations.go | 7 +++- cmd/porter/parameters.go | 7 +++- docs/content/cli/build.md | 4 +-- docs/content/cli/bundles_build.md | 4 +-- docs/content/cli/credentials_list.md | 3 ++ docs/content/cli/installations_list.md | 3 ++ docs/content/cli/list.md | 3 ++ docs/content/cli/parameters_list.md | 3 ++ pkg/cli/config.go | 2 ++ pkg/porter/credentials.go | 8 ++++- pkg/porter/list.go | 10 +++++- pkg/porter/parameters.go | 8 ++++- pkg/storage/credential_store.go | 7 ++-- pkg/storage/credential_store_test.go | 31 ++++++++++++++--- pkg/storage/credentialset_provider.go | 2 +- pkg/storage/installation_provider.go | 2 +- pkg/storage/installation_store.go | 9 ++--- pkg/storage/installation_store_test.go | 36 ++++++++++++++++++-- pkg/storage/migrations/manager_test.go | 24 ++++++++----- pkg/storage/parameter_store.go | 7 ++-- pkg/storage/parameter_store_test.go | 41 ++++++++++++++++++---- pkg/storage/parameterset_provider.go | 2 +- pkg/storage/query.go | 47 ++++++++++++++++++++------ pkg/storage/query_test.go | 25 ++++++++++++++ 25 files changed, 238 insertions(+), 64 deletions(-) diff --git a/cmd/porter/credentials.go b/cmd/porter/credentials.go index 31c934c94..30d878411 100644 --- a/cmd/porter/credentials.go +++ b/cmd/porter/credentials.go @@ -143,7 +143,8 @@ The results may also be filtered by associated labels and the namespace in which porter credentials list --namespace prod porter credentials list --all-namespaces, porter credentials list --name myapp - porter credentials list --label env=dev`, + porter credentials list --label env=dev + porter credentials list --skip 2 --limit 2`, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.Validate() }, @@ -163,6 +164,10 @@ The results may also be filtered by associated labels and the namespace in which "Filter the credential sets by a label formatted as: KEY=VALUE. May be specified multiple times.") f.StringVarP(&opts.RawFormat, "output", "o", "plaintext", "Specify an output format. Allowed values: plaintext, json, yaml") + f.Int64Var(&opts.Skip, "skip", 0, + "Skip the number of credential sets by a certain amount. Defaults to 0.") + f.Int64Var(&opts.Limit, "limit", 0, + "Limit the number of credential sets by a certain amount. Defaults to 0.") return cmd } diff --git a/cmd/porter/installations.go b/cmd/porter/installations.go index b78b16abd..04abb8b4a 100644 --- a/cmd/porter/installations.go +++ b/cmd/porter/installations.go @@ -44,7 +44,8 @@ Optional output formats include json and yaml.`, porter installations list -o json porter installations list --all-namespaces, porter installations list --label owner=myname --namespace dev - porter installations list --name myapp`, + porter installations list --name myapp + porter installations list --skip 2 --limit 2`, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.Validate() }, @@ -64,6 +65,10 @@ Optional output formats include json and yaml.`, "Filter the installations by a label formatted as: KEY=VALUE. May be specified multiple times.") f.StringVarP(&opts.RawFormat, "output", "o", "plaintext", "Specify an output format. Allowed values: plaintext, json, yaml") + f.Int64Var(&opts.Skip, "skip", 0, + "Skip the number of installations by a certain amount. Defaults to 0.") + f.Int64Var(&opts.Limit, "limit", 0, + "Limit the number of installations by a certain amount. Defaults to 0.") return cmd } diff --git a/cmd/porter/parameters.go b/cmd/porter/parameters.go index ef004dd48..ea00b938c 100644 --- a/cmd/porter/parameters.go +++ b/cmd/porter/parameters.go @@ -142,7 +142,8 @@ The results may also be filtered by associated labels and the namespace in which porter parameters list --namespace prod -o json porter parameters list --all-namespaces, porter parameters list --name myapp - porter parameters list --label env=dev`, + porter parameters list --label env=dev + porter parameters list --skip 2 --limit 2`, PreRunE: func(cmd *cobra.Command, args []string) error { return opts.Validate() }, @@ -162,6 +163,10 @@ The results may also be filtered by associated labels and the namespace in which "Filter the parameter sets by a label formatted as: KEY=VALUE. May be specified multiple times.") f.StringVarP(&opts.RawFormat, "output", "o", "plaintext", "Specify an output format. Allowed values: plaintext, json, yaml") + f.Int64Var(&opts.Skip, "skip", 0, + "Skip the number of parameter sets by a certain amount. Defaults to 0.") + f.Int64Var(&opts.Limit, "limit", 0, + "Limit the number of parameter sets by a certain amount. Defaults to 0.") return cmd } diff --git a/docs/content/cli/build.md b/docs/content/cli/build.md index 83f25cd28..155de2177 100644 --- a/docs/content/cli/build.md +++ b/docs/content/cli/build.md @@ -39,8 +39,8 @@ porter build [flags] ``` --build-arg stringArray Set build arguments in the template Dockerfile (format: NAME=VALUE). May be specified multiple times. --custom stringArray Define an individual key-value pair for the custom section in the form of NAME=VALUE. Use dot notation to specify a nested custom field. May be specified multiple times. - -d, --dir string Path to the build context directory where all bundle assets are located. - -f, --file porter.yaml Path to the Porter manifest. Defaults to porter.yaml in the current directory. + -d, --dir string Path to the build context directory where all bundle assets are located. Defaults to the current directory. + -f, --file string Path to the Porter manifest. The path is relative to the build context directory. Defaults to porter.yaml in the current directory. -h, --help help for build --name string Override the bundle name --no-cache Do not use the Docker cache when building the bundle's invocation image. diff --git a/docs/content/cli/bundles_build.md b/docs/content/cli/bundles_build.md index 9f7a0f1bf..6498ac0df 100644 --- a/docs/content/cli/bundles_build.md +++ b/docs/content/cli/bundles_build.md @@ -39,8 +39,8 @@ porter bundles build [flags] ``` --build-arg stringArray Set build arguments in the template Dockerfile (format: NAME=VALUE). May be specified multiple times. --custom stringArray Define an individual key-value pair for the custom section in the form of NAME=VALUE. Use dot notation to specify a nested custom field. May be specified multiple times. - -d, --dir string Path to the build context directory where all bundle assets are located. - -f, --file porter.yaml Path to the Porter manifest. Defaults to porter.yaml in the current directory. + -d, --dir string Path to the build context directory where all bundle assets are located. Defaults to the current directory. + -f, --file string Path to the Porter manifest. The path is relative to the build context directory. Defaults to porter.yaml in the current directory. -h, --help help for build --name string Override the bundle name --no-cache Do not use the Docker cache when building the bundle's invocation image. diff --git a/docs/content/cli/credentials_list.md b/docs/content/cli/credentials_list.md index 5a5940d53..d0ec4fef5 100644 --- a/docs/content/cli/credentials_list.md +++ b/docs/content/cli/credentials_list.md @@ -26,6 +26,7 @@ porter credentials list [flags] porter credentials list --all-namespaces, porter credentials list --name myapp porter credentials list --label env=dev + porter credentials list --skip 2 --limit 2 ``` ### Options @@ -34,9 +35,11 @@ porter credentials list [flags] --all-namespaces Include all namespaces in the results. -h, --help help for list -l, --label strings Filter the credential sets by a label formatted as: KEY=VALUE. May be specified multiple times. + --limit int Limit the number of credential sets by a certain amount. Defaults to 0. --name string Filter the credential sets where the name contains the specified substring. -n, --namespace string Namespace in which the credential set is defined. Defaults to the global namespace. Use * to list across all namespaces. -o, --output string Specify an output format. Allowed values: plaintext, json, yaml (default "plaintext") + --skip int Skip the number of credential sets by a certain amount. Defaults to 0. ``` ### Options inherited from parent commands diff --git a/docs/content/cli/installations_list.md b/docs/content/cli/installations_list.md index 33e68c361..081fdf281 100644 --- a/docs/content/cli/installations_list.md +++ b/docs/content/cli/installations_list.md @@ -29,6 +29,7 @@ porter installations list [flags] porter installations list --all-namespaces, porter installations list --label owner=myname --namespace dev porter installations list --name myapp + porter installations list --skip 2 --limit 2 ``` ### Options @@ -37,9 +38,11 @@ porter installations list [flags] --all-namespaces Include all namespaces in the results. -h, --help help for list -l, --label strings Filter the installations by a label formatted as: KEY=VALUE. May be specified multiple times. + --limit int Limit the number of installations by a certain amount. Defaults to 0. --name string Filter the installations where the name contains the specified substring. -n, --namespace string Filter the installations by namespace. Defaults to the global namespace. -o, --output string Specify an output format. Allowed values: plaintext, json, yaml (default "plaintext") + --skip int Skip the number of installations by a certain amount. Defaults to 0. ``` ### Options inherited from parent commands diff --git a/docs/content/cli/list.md b/docs/content/cli/list.md index b3388da37..d7a44d0cd 100644 --- a/docs/content/cli/list.md +++ b/docs/content/cli/list.md @@ -29,6 +29,7 @@ porter list [flags] porter list --all-namespaces, porter list --label owner=myname --namespace dev porter list --name myapp + porter list --skip 2 --limit 2 ``` ### Options @@ -37,9 +38,11 @@ porter list [flags] --all-namespaces Include all namespaces in the results. -h, --help help for list -l, --label strings Filter the installations by a label formatted as: KEY=VALUE. May be specified multiple times. + --limit int Limit the number of installations by a certain amount. Defaults to 0. --name string Filter the installations where the name contains the specified substring. -n, --namespace string Filter the installations by namespace. Defaults to the global namespace. -o, --output string Specify an output format. Allowed values: plaintext, json, yaml (default "plaintext") + --skip int Skip the number of installations by a certain amount. Defaults to 0. ``` ### Options inherited from parent commands diff --git a/docs/content/cli/parameters_list.md b/docs/content/cli/parameters_list.md index 5787a42c9..a6ade63e6 100644 --- a/docs/content/cli/parameters_list.md +++ b/docs/content/cli/parameters_list.md @@ -26,6 +26,7 @@ porter parameters list [flags] porter parameters list --all-namespaces, porter parameters list --name myapp porter parameters list --label env=dev + porter parameters list --skip 2 --limit 2 ``` ### Options @@ -34,9 +35,11 @@ porter parameters list [flags] --all-namespaces Include all namespaces in the results. -h, --help help for list -l, --label strings Filter the parameter sets by a label formatted as: KEY=VALUE. May be specified multiple times. + --limit int Limit the number of parameter sets by a certain amount. Defaults to 0. --name string Filter the parameter sets where the name contains the specified substring. -n, --namespace string Namespace in which the parameter set is defined. Defaults to the global namespace. Use * to list across all namespaces. -o, --output string Specify an output format. Allowed values: plaintext, json, yaml (default "plaintext") + --skip int Skip the number of parameter sets by a certain amount. Defaults to 0. ``` ### Options inherited from parent commands diff --git a/pkg/cli/config.go b/pkg/cli/config.go index 2f7ca3328..f7ce91413 100644 --- a/pkg/cli/config.go +++ b/pkg/cli/config.go @@ -71,6 +71,8 @@ func getViperValue(flags *pflag.FlagSet, f *pflag.Flag) interface{} { switch flagType { case "int": out, err = flags.GetInt(f.Name) + case "int64": + out, err = flags.GetInt64(f.Name) case "string": out, err = flags.GetString(f.Name) case "bool": diff --git a/pkg/porter/credentials.go b/pkg/porter/credentials.go index f30b1365f..05e83720d 100644 --- a/pkg/porter/credentials.go +++ b/pkg/porter/credentials.go @@ -31,7 +31,13 @@ type CredentialEditOptions struct { // ListCredentials lists saved credential sets. func (p *Porter) ListCredentials(ctx context.Context, opts ListOptions) ([]storage.CredentialSet, error) { - return p.Credentials.ListCredentialSets(ctx, opts.GetNamespace(), opts.Name, opts.ParseLabels()) + return p.Credentials.ListCredentialSets(ctx, storage.ListOptions{ + Namespace: opts.GetNamespace(), + Name: opts.Name, + Labels: opts.ParseLabels(), + Skip: opts.Skip, + Limit: opts.Limit, + }) } // PrintCredentials prints saved credential sets. diff --git a/pkg/porter/list.go b/pkg/porter/list.go index a8aeb8765..84b746543 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -24,6 +24,8 @@ type ListOptions struct { Namespace string Name string Labels []string + Skip int64 + Limit int64 } func (o *ListOptions) Validate() error { @@ -218,7 +220,13 @@ func (p *Porter) ListInstallations(ctx context.Context, opts ListOptions) (Displ ctx, log := tracing.StartSpan(ctx) defer log.EndSpan() - installations, err := p.Installations.ListInstallations(ctx, opts.GetNamespace(), opts.Name, opts.ParseLabels()) + installations, err := p.Installations.ListInstallations(ctx, storage.ListOptions{ + Namespace: opts.GetNamespace(), + Name: opts.Name, + Labels: opts.ParseLabels(), + Skip: opts.Skip, + Limit: opts.Limit, + }) if err != nil { return nil, log.Error(fmt.Errorf("could not list installations: %w", err)) } diff --git a/pkg/porter/parameters.go b/pkg/porter/parameters.go index 2dc9467db..218944f65 100644 --- a/pkg/porter/parameters.go +++ b/pkg/porter/parameters.go @@ -38,7 +38,13 @@ type ParameterEditOptions struct { // ListParameters lists saved parameter sets. func (p *Porter) ListParameters(ctx context.Context, opts ListOptions) ([]storage.ParameterSet, error) { - return p.Parameters.ListParameterSets(ctx, opts.GetNamespace(), opts.Name, opts.ParseLabels()) + return p.Parameters.ListParameterSets(ctx, storage.ListOptions{ + Namespace: opts.GetNamespace(), + Name: opts.Name, + Labels: opts.ParseLabels(), + Skip: opts.Skip, + Limit: opts.Limit, + }) } // PrintParameters prints saved parameter sets. diff --git a/pkg/storage/credential_store.go b/pkg/storage/credential_store.go index 71acd6008..e30ee6d51 100644 --- a/pkg/storage/credential_store.go +++ b/pkg/storage/credential_store.go @@ -110,12 +110,9 @@ func (s CredentialStore) InsertCredentialSet(ctx context.Context, creds Credenti return s.Documents.Insert(ctx, CollectionCredentials, opts) } -func (s CredentialStore) ListCredentialSets(ctx context.Context, namespace string, name string, labels map[string]string) ([]CredentialSet, error) { +func (s CredentialStore) ListCredentialSets(ctx context.Context, listOptions ListOptions) ([]CredentialSet, error) { var out []CredentialSet - opts := FindOptions{ - Filter: CreateListFiler(namespace, name, labels), - } - err := s.Documents.Find(ctx, CollectionCredentials, opts, &out) + err := s.Documents.Find(ctx, CollectionCredentials, listOptions.ToFindOptions(), &out) return out, err } diff --git a/pkg/storage/credential_store_test.go b/pkg/storage/credential_store_test.go index 9ee62abc0..0336ad917 100644 --- a/pkg/storage/credential_store_test.go +++ b/pkg/storage/credential_store_test.go @@ -20,17 +20,17 @@ func TestCredentialStorage_CRUD(t *testing.T) { require.NoError(t, cp.InsertCredentialSet(context.Background(), cs)) - creds, err := cp.ListCredentialSets(context.Background(), "dev", "", nil) + creds, err := cp.ListCredentialSets(context.Background(), ListOptions{Namespace: "dev"}) require.NoError(t, err) require.Len(t, creds, 1, "expected 1 credential set") - require.Equal(t, cs.Name, creds[0].Name, "expected to retrieve secreks credentials") - require.Equal(t, cs.Namespace, creds[0].Namespace, "expected to retrieve secreks credentials") + require.Equal(t, cs.Name, creds[0].Name, "expected to retrieve sekrets credentials") + require.Equal(t, cs.Namespace, creds[0].Namespace, "expected to retrieve sekrets credentials") - creds, err = cp.ListCredentialSets(context.Background(), "", "", nil) + creds, err = cp.ListCredentialSets(context.Background(), ListOptions{}) require.NoError(t, err) require.Len(t, creds, 0, "expected no global credential sets") - creds, err = cp.ListCredentialSets(context.Background(), "*", "", nil) + creds, err = cp.ListCredentialSets(context.Background(), ListOptions{Namespace: "*"}) require.NoError(t, err) require.Len(t, creds, 1, "expected 1 credential set defined in all namespaces") @@ -45,9 +45,30 @@ func TestCredentialStorage_CRUD(t *testing.T) { require.NoError(t, err) assert.Len(t, cs.Credentials, 2) + cs2 := NewCredentialSet("dev", "sekrets-2", secrets.Strategy{ + Name: "password-2", Source: secrets.Source{ + Key: "secret-2", + Value: "dbPassword-2"}}) + require.NoError(t, cp.InsertCredentialSet(context.Background(), cs2)) + + creds, err = cp.ListCredentialSets(context.Background(), ListOptions{Namespace: "dev", Skip: 1}) + require.NoError(t, err) + require.Len(t, creds, 1, "expected 1 credential set") + require.Equal(t, cs2.Name, creds[0].Name, "expected to retrieve sekrets-2 credentials") + require.Equal(t, cs2.Namespace, creds[0].Namespace, "expected to retrieve sekrets-2 credentials") + + creds, err = cp.ListCredentialSets(context.Background(), ListOptions{Namespace: "dev", Limit: 1}) + require.NoError(t, err) + require.Len(t, creds, 1, "expected 1 credential set") + require.Equal(t, cs.Name, creds[0].Name, "expected to retrieve sekrets credentials") + require.Equal(t, cs.Namespace, creds[0].Namespace, "expected to retrieve sekrets credentials") + require.NoError(t, cp.RemoveCredentialSet(context.Background(), cs.Namespace, cs.Name)) + require.NoError(t, cp.RemoveCredentialSet(context.Background(), cs2.Namespace, cs2.Name)) _, err = cp.GetCredentialSet(context.Background(), cs.Namespace, cs.Name) require.ErrorIs(t, err, ErrNotFound{}) + _, err = cp.GetCredentialSet(context.Background(), cs2.Namespace, cs2.Name) + require.ErrorIs(t, err, ErrNotFound{}) } func TestCredentialStorage_Validate_GoodSources(t *testing.T) { diff --git a/pkg/storage/credentialset_provider.go b/pkg/storage/credentialset_provider.go index 8db1faa07..cfa83eb37 100644 --- a/pkg/storage/credentialset_provider.go +++ b/pkg/storage/credentialset_provider.go @@ -12,7 +12,7 @@ type CredentialSetProvider interface { ResolveAll(ctx context.Context, creds CredentialSet) (secrets.Set, error) Validate(ctx context.Context, creds CredentialSet) error InsertCredentialSet(ctx context.Context, creds CredentialSet) error - ListCredentialSets(ctx context.Context, namespace string, name string, labels map[string]string) ([]CredentialSet, error) + ListCredentialSets(ctx context.Context, listOptions ListOptions) ([]CredentialSet, error) GetCredentialSet(ctx context.Context, namespace string, name string) (CredentialSet, error) UpdateCredentialSet(ctx context.Context, creds CredentialSet) error RemoveCredentialSet(ctx context.Context, namespace string, name string) error diff --git a/pkg/storage/installation_provider.go b/pkg/storage/installation_provider.go index 6c8111c13..9d0b6b929 100644 --- a/pkg/storage/installation_provider.go +++ b/pkg/storage/installation_provider.go @@ -35,7 +35,7 @@ type InstallationProvider interface { GetInstallation(ctx context.Context, namespace string, name string) (Installation, error) // ListInstallations returns Installations sorted in ascending order by the namespace and then name. - ListInstallations(ctx context.Context, namespace string, name string, labels map[string]string) ([]Installation, error) + ListInstallations(ctx context.Context, listOption ListOptions) ([]Installation, error) // ListRuns returns Run documents sorted in ascending order by ID. ListRuns(ctx context.Context, namespace string, installation string) ([]Run, map[string][]Result, error) diff --git a/pkg/storage/installation_store.go b/pkg/storage/installation_store.go index 9dc4cf66e..bfda84df0 100644 --- a/pkg/storage/installation_store.go +++ b/pkg/storage/installation_store.go @@ -63,17 +63,12 @@ func (s InstallationStore) Initialize(ctx context.Context) error { return span.Error(err) } -func (s InstallationStore) ListInstallations(ctx context.Context, namespace string, name string, labels map[string]string) ([]Installation, error) { +func (s InstallationStore) ListInstallations(ctx context.Context, listOptions ListOptions) ([]Installation, error) { _, log := tracing.StartSpan(ctx) defer log.EndSpan() var out []Installation - findOpts := FindOptions{ - Sort: []string{"namespace", "name"}, - Filter: CreateListFiler(namespace, name, labels), - } - - err := s.store.Find(ctx, CollectionInstallations, findOpts, &out) + err := s.store.Find(ctx, CollectionInstallations, listOptions.ToFindOptions(), &out) return out, err } diff --git a/pkg/storage/installation_store_test.go b/pkg/storage/installation_store_test.go index 3a0c5f9d6..6c2ecaa34 100644 --- a/pkg/storage/installation_store_test.go +++ b/pkg/storage/installation_store_test.go @@ -165,7 +165,7 @@ func TestInstallationStorageProvider_Installations(t *testing.T) { defer cp.Close() t.Run("ListInstallations", func(t *testing.T) { - installations, err := cp.ListInstallations(context.Background(), "dev", "", nil) + installations, err := cp.ListInstallations(context.Background(), ListOptions{Namespace: "dev"}) require.NoError(t, err, "ListInstallations failed") require.Len(t, installations, 3, "Expected 3 installations") @@ -183,6 +183,36 @@ func TestInstallationStorageProvider_Installations(t *testing.T) { assert.Equal(t, cnab.StatusSucceeded, foo.Status.ResultStatus) }) + t.Run("ListInstallations with skip option", func(t *testing.T) { + installations, err := cp.ListInstallations(context.Background(), ListOptions{Namespace: "dev", Skip: 1}) + require.NoError(t, err, "ListInstallations failed") + + require.Len(t, installations, 2, "Expected 2 installations") + + bar := installations[0] + assert.Equal(t, "baz", bar.Name) + assert.Equal(t, cnab.StatusRunning, bar.Status.ResultStatus) + + baz := installations[1] + assert.Equal(t, "foo", baz.Name) + assert.Equal(t, cnab.StatusSucceeded, baz.Status.ResultStatus) + }) + + t.Run("ListInstallations with limit option", func(t *testing.T) { + installations, err := cp.ListInstallations(context.Background(), ListOptions{Namespace: "dev", Limit: 2}) + require.NoError(t, err, "ListInstallations failed") + + require.Len(t, installations, 2, "Expected 2 installations") + + bar := installations[0] + assert.Equal(t, "bar", bar.Name) + assert.Equal(t, cnab.StatusSucceeded, bar.Status.ResultStatus) + + baz := installations[1] + assert.Equal(t, "baz", baz.Name) + assert.Equal(t, cnab.StatusRunning, baz.Status.ResultStatus) + }) + t.Run("FindInstallations by label", func(t *testing.T) { opts := FindOptions{ Filter: map[string]interface{}{ @@ -236,14 +266,14 @@ func TestInstallationStorageProvider_DeleteInstallation(t *testing.T) { cp := generateInstallationData(t) defer cp.Close() - installations, err := cp.ListInstallations(context.Background(), "dev", "", nil) + installations, err := cp.ListInstallations(context.Background(), ListOptions{Namespace: "dev"}) require.NoError(t, err, "ListInstallations failed") assert.Len(t, installations, 3, "expected 3 installations") err = cp.RemoveInstallation(context.Background(), "dev", "foo") require.NoError(t, err, "RemoveInstallation failed") - installations, err = cp.ListInstallations(context.Background(), "dev", "", nil) + installations, err = cp.ListInstallations(context.Background(), ListOptions{Namespace: "dev"}) require.NoError(t, err, "ListInstallations failed") assert.Len(t, installations, 2, "expected foo to be deleted") diff --git a/pkg/storage/migrations/manager_test.go b/pkg/storage/migrations/manager_test.go index 52830e1cd..e559ad27b 100644 --- a/pkg/storage/migrations/manager_test.go +++ b/pkg/storage/migrations/manager_test.go @@ -61,15 +61,15 @@ func TestManager_NoMigrationEmptyHome(t *testing.T) { defer mgr.Close() claimStore := storage.NewInstallationStore(mgr) - _, err := claimStore.ListInstallations(context.Background(), "", "", nil) + _, err := claimStore.ListInstallations(context.Background(), storage.ListOptions{}) require.NoError(t, err, "ListInstallations failed") credStore := storage.NewCredentialStore(mgr, nil) - _, err = credStore.ListCredentialSets(context.Background(), "", "", nil) + _, err = credStore.ListCredentialSets(context.Background(), storage.ListOptions{}) require.NoError(t, err, "List credentials failed") paramStore := storage.NewParameterStore(mgr, nil) - _, err = paramStore.ListParameterSets(context.Background(), "", "", nil) + _, err = paramStore.ListParameterSets(context.Background(), storage.ListOptions{}) require.NoError(t, err, "List credentials failed") } @@ -101,7 +101,7 @@ storage.Schema{ID:"schema", Installations:"needs-migration", Credentials:"1.0.1" } t.Run("list", func(t *testing.T) { - _, err = claimStore.ListInstallations(context.Background(), "", "", nil) + _, err = claimStore.ListInstallations(context.Background(), storage.ListOptions{}) checkMigrationError(t, err) }) @@ -124,7 +124,7 @@ func TestClaimStorage_NoMigrationRequiredForEmptyHome(t *testing.T) { defer mgr.Close() claimStore := storage.NewInstallationStore(mgr) - names, err := claimStore.ListInstallations(context.Background(), "", "", nil) + names, err := claimStore.ListInstallations(context.Background(), storage.ListOptions{}) require.NoError(t, err, "ListInstallations failed") assert.Empty(t, names, "Expected an empty list of installations since porter home is new") } @@ -156,7 +156,7 @@ storage.Schema{ID:"schema", Installations:"1.0.1", Credentials:"needs-migration" } t.Run("list", func(t *testing.T) { - _, err = credStore.ListCredentialSets(context.Background(), "", "", nil) + _, err = credStore.ListCredentialSets(context.Background(), storage.ListOptions{}) checkMigrationError(t, err) }) @@ -177,7 +177,13 @@ func TestCredentialStorage_NoMigrationRequiredForEmptyHome(t *testing.T) { testSecrets := secrets.NewTestSecretsProvider() credStore := storage.NewTestCredentialProviderFor(t, mgr, testSecrets) - names, err := credStore.ListCredentialSets(context.Background(), "", "", nil) + names, err := credStore.ListCredentialSets(context.Background(), storage.ListOptions{ + Namespace: "", + Name: "", + Labels: nil, + Skip: 0, + Limit: 0, + }) require.NoError(t, err, "List failed") assert.Empty(t, names, "Expected an empty list of credentials since porter home is new") } @@ -209,7 +215,7 @@ storage.Schema{ID:"schema", Installations:"1.0.1", Credentials:"1.0.1", Paramete } t.Run("list", func(t *testing.T) { - _, err = paramStore.ListParameterSets(context.Background(), "", "", nil) + _, err = paramStore.ListParameterSets(context.Background(), storage.ListOptions{}) checkMigrationError(t, err) }) @@ -230,7 +236,7 @@ func TestParameterStorage_NoMigrationRequiredForEmptyHome(t *testing.T) { testSecrets := secrets.NewTestSecretsProvider() paramStore := storage.NewTestParameterProviderFor(t, mgr, testSecrets) - names, err := paramStore.ListParameterSets(context.Background(), "", "", nil) + names, err := paramStore.ListParameterSets(context.Background(), storage.ListOptions{}) require.NoError(t, err, "List failed") assert.Empty(t, names, "Expected an empty list of parameters since porter home is new") } diff --git a/pkg/storage/parameter_store.go b/pkg/storage/parameter_store.go index e1c641a2f..658cf9e9d 100644 --- a/pkg/storage/parameter_store.go +++ b/pkg/storage/parameter_store.go @@ -100,12 +100,9 @@ func (s ParameterStore) InsertParameterSet(ctx context.Context, params Parameter return s.Documents.Insert(ctx, CollectionParameters, opts) } -func (s ParameterStore) ListParameterSets(ctx context.Context, namespace string, name string, labels map[string]string) ([]ParameterSet, error) { +func (s ParameterStore) ListParameterSets(ctx context.Context, listOptions ListOptions) ([]ParameterSet, error) { var out []ParameterSet - opts := FindOptions{ - Filter: CreateListFiler(namespace, name, labels), - } - err := s.Documents.Find(ctx, CollectionParameters, opts, &out) + err := s.Documents.Find(ctx, CollectionParameters, listOptions.ToFindOptions(), &out) return out, err } diff --git a/pkg/storage/parameter_store_test.go b/pkg/storage/parameter_store_test.go index 4f75eb53c..055390a64 100644 --- a/pkg/storage/parameter_store_test.go +++ b/pkg/storage/parameter_store_test.go @@ -14,7 +14,7 @@ func TestParameterStore_CRUD(t *testing.T) { defer paramStore.Close() ctx := context.Background() - params, err := paramStore.ListParameterSets(ctx, "dev", "", nil) + params, err := paramStore.ListParameterSets(ctx, ListOptions{Namespace: "dev"}) require.NoError(t, err) require.Empty(t, params, "Find should return no entries") @@ -32,16 +32,16 @@ func TestParameterStore_CRUD(t *testing.T) { err = paramStore.InsertParameterSet(ctx, myParamSet) require.NoError(t, err, "Insert should successfully save") - params, err = paramStore.ListParameterSets(ctx, "dev", "", nil) + params, err = paramStore.ListParameterSets(ctx, ListOptions{Namespace: "dev"}) require.NoError(t, err) require.Len(t, params, 1, "expected 1 parameter set") - require.Equal(t, myParamSet.Name, params[0].Name, "expected to retrieve myparams") + require.Equal(t, myParamSet.Name, params[0].Name, "expected to retrieve myparam") - params, err = paramStore.ListParameterSets(ctx, "", "", nil) + params, err = paramStore.ListParameterSets(ctx, ListOptions{}) require.NoError(t, err) require.Len(t, params, 0, "expected no global parameter sets") - params, err = paramStore.ListParameterSets(ctx, "*", "", nil) + params, err = paramStore.ListParameterSets(ctx, ListOptions{Namespace: "*"}) require.NoError(t, err) require.Len(t, params, 1, "expected 1 parameter set defined in all namespaces") @@ -49,16 +49,45 @@ func TestParameterStore_CRUD(t *testing.T) { require.NoError(t, err) require.Equal(t, myParamSet, pset, "Get should return the saved parameter set") + myParamSet2 := NewParameterSet("dev", "myparams2", + secrets.Strategy{ + Name: "myparam2", + Source: secrets.Source{ + Key: "value2", + Value: "myparamvalue2", + }, + }) + myParamSet2.Status.Created = time.Date(2020, 1, 1, 12, 0, 0, 0, time.UTC) + myParamSet2.Status.Modified = myParamSet2.Status.Created + + err = paramStore.InsertParameterSet(ctx, myParamSet2) + require.NoError(t, err, "Insert should successfully save") + + params, err = paramStore.ListParameterSets(ctx, ListOptions{Namespace: "dev", Skip: 1}) + require.NoError(t, err) + require.Len(t, params, 1, "expected 1 parameter set") + require.Equal(t, myParamSet2.Name, params[0].Name, "expected to retrieve myparam2") + + params, err = paramStore.ListParameterSets(ctx, ListOptions{Namespace: "dev", Limit: 1}) + require.NoError(t, err) + require.Len(t, params, 1, "expected 1 parameter set") + require.Equal(t, myParamSet.Name, params[0].Name, "expected to retrieve myparam") + err = paramStore.RemoveParameterSet(ctx, myParamSet.Namespace, myParamSet.Name) require.NoError(t, err, "Remove should successfully delete the parameter set") - params, err = paramStore.ListParameterSets(ctx, "dev", "", nil) + err = paramStore.RemoveParameterSet(ctx, myParamSet2.Namespace, myParamSet2.Name) + require.NoError(t, err, "Remove should successfully delete the parameter set") + + params, err = paramStore.ListParameterSets(ctx, ListOptions{Namespace: "dev"}) require.NoError(t, err) require.Empty(t, params, "List should return no entries") pset, err = paramStore.GetParameterSet(ctx, "", myParamSet.Name) require.ErrorIs(t, err, ErrNotFound{}) + pset, err = paramStore.GetParameterSet(ctx, "", myParamSet2.Name) + require.ErrorIs(t, err, ErrNotFound{}) } func TestParameterStorage_ResolveAll(t *testing.T) { diff --git a/pkg/storage/parameterset_provider.go b/pkg/storage/parameterset_provider.go index 86944f8ae..64b35c3d3 100644 --- a/pkg/storage/parameterset_provider.go +++ b/pkg/storage/parameterset_provider.go @@ -17,7 +17,7 @@ type ParameterSetProvider interface { Validate(ctx context.Context, params ParameterSet) error InsertParameterSet(ctx context.Context, params ParameterSet) error - ListParameterSets(ctx context.Context, namespace string, name string, labels map[string]string) ([]ParameterSet, error) + ListParameterSets(ctx context.Context, listOptions ListOptions) ([]ParameterSet, error) GetParameterSet(ctx context.Context, namespace string, name string) (ParameterSet, error) UpdateParameterSet(ctx context.Context, params ParameterSet) error UpsertParameterSet(ctx context.Context, params ParameterSet) error diff --git a/pkg/storage/query.go b/pkg/storage/query.go index 0e686d2ac..f19dab6cb 100644 --- a/pkg/storage/query.go +++ b/pkg/storage/query.go @@ -288,20 +288,45 @@ func convertToRawJsonDocument(in interface{}, raw interface{}) error { return json.Unmarshal(data, raw) } -// CreateListFiler builds a query for a list of documents by: -// * matching namespace -// * name contains substring -// * labels contains all matches -func CreateListFiler(namespace string, name string, labels map[string]string) map[string]interface{} { +// ListOptions is the set of options available to the list operation +// on any storage provider. +type ListOptions struct { + // Namespace in which the particular result list is defined. + Namespace string + + // Name specifies whether the result list name contain the specified substring. + Name string + + // Labels is used to filter result list based on a key-value pair. + Labels map[string]string + + // Skip is the number of results to skip past and exclude from the results. + Skip int64 + + // Limit is the number of results to return. + Limit int64 +} + +// ToFindOptions builds a query for a list of documents with these conditions: +// * sorted in ascending order by namespace first and then name +// * filtered by matching namespace, name contains substring, and labels contain all matches +// * skipped and limited to a certain number of result +func (o ListOptions) ToFindOptions() FindOptions { filter := make(map[string]interface{}, 3) - if namespace != "*" { - filter["namespace"] = namespace + if o.Namespace != "*" { + filter["namespace"] = o.Namespace } - if name != "" { - filter["name"] = map[string]interface{}{"$regex": name} + if o.Name != "" { + filter["name"] = map[string]interface{}{"$regex": o.Name} } - for k, v := range labels { + for k, v := range o.Labels { filter["labels."+k] = v } - return filter + + return FindOptions{ + Sort: []string{"namespace", "name"}, + Filter: filter, + Skip: o.Skip, + Limit: o.Limit, + } } diff --git a/pkg/storage/query_test.go b/pkg/storage/query_test.go index 8c93646bf..133b5e3f0 100644 --- a/pkg/storage/query_test.go +++ b/pkg/storage/query_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" ) var _ Document = TestDocument{} @@ -72,3 +73,27 @@ func TestFindOptions_ToPluginOptions(t *testing.T) { {"name", 1}} require.Equal(t, wantSortDoc, po.Sort) } + +func TestListOptions_ToFindOptions(t *testing.T) { + opts := ListOptions{ + Namespace: "dev", + Name: "name", + Labels: map[string]string{"key": "value"}, + Skip: 1, + Limit: 1, + } + + wantOpts := FindOptions{ + Sort: []string{"namespace", "name"}, + Skip: 1, + Limit: 1, + Filter: primitive.M{ + "labels.key": "value", + "name": map[string]interface{}{"$regex": "name"}, + "namespace": "dev", + }, + } + + gotOpts := opts.ToFindOptions() + require.Equal(t, wantOpts, gotOpts) +} From 0443a86d1d1efce8d2143c1935007c56f88b3146 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Sat, 18 Jun 2022 14:51:59 +0700 Subject: [PATCH 05/23] Add state and status to list installation Signed-off-by: joshuabezaleel --- pkg/porter/list.go | 81 +++++++++++++++---- pkg/porter/testdata/show/expected-output.json | 4 +- pkg/porter/testdata/show/expected-output.yaml | 2 + pkg/storage/installation.go | 5 ++ 4 files changed, 77 insertions(+), 15 deletions(-) diff --git a/pkg/porter/list.go b/pkg/porter/list.go index 84b746543..bf083ad98 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -17,6 +17,16 @@ import ( "github.com/pkg/errors" ) +const ( + StateInstalled = "installed" + StateUninstalled = "uninstalled" + StateDefined = "defined" + + StatusInstalling = "installing" + StatusUninstalling = "uninstalling" + StatusUpgrading = "upgrading" +) + // ListOptions represent generic options for use by Porter's list commands type ListOptions struct { printer.PrintOptions @@ -102,6 +112,9 @@ type DisplayInstallation struct { // Status of the installation. Status storage.InstallationStatus `json:"status,omitempty" yaml:"status,omitempty" toml:"status,omitempty"` DisplayInstallationMetadata `json:"_calculated" yaml:"_calculated"` + + DisplayInstallationState string `json:"displayInstallationState,omitempty" yaml:"displayInstallationState,omitempty" toml:"displayInstallationState,omitempty"` + DisplayInstallationStatus string `json:"displayInstallationStatus,omitempty" yaml:"displayInstallationStatus,omitempty" toml:"displayInstallationStatus,omitempty"` } type DisplayInstallationMetadata struct { @@ -111,18 +124,20 @@ type DisplayInstallationMetadata struct { func NewDisplayInstallation(installation storage.Installation) DisplayInstallation { di := DisplayInstallation{ - SchemaType: "Installation", - SchemaVersion: installation.SchemaVersion, - ID: installation.ID, - Name: installation.Name, - Namespace: installation.Namespace, - Uninstalled: installation.Uninstalled, - Bundle: installation.Bundle, - Custom: installation.Custom, - Labels: installation.Labels, - CredentialSets: installation.CredentialSets, - ParameterSets: installation.ParameterSets, - Status: installation.Status, + SchemaType: "Installation", + SchemaVersion: installation.SchemaVersion, + ID: installation.ID, + Name: installation.Name, + Namespace: installation.Namespace, + Uninstalled: installation.Uninstalled, + Bundle: installation.Bundle, + Custom: installation.Custom, + Labels: installation.Labels, + CredentialSets: installation.CredentialSets, + ParameterSets: installation.ParameterSets, + Status: installation.Status, + DisplayInstallationState: setDisplayInstallationState(installation), + DisplayInstallationStatus: setDisplayInstallationStatus(installation), } return di @@ -266,11 +281,49 @@ func (p *Porter) PrintInstallations(ctx context.Context, opts ListOptions) error if !ok { return nil } - return []string{cl.Namespace, cl.Name, tp.Format(cl.Status.Created), tp.Format(cl.Status.Modified), cl.Status.Action, cl.Status.ResultStatus} + return []string{cl.Namespace, cl.Name, cl.Status.BundleVersion, cl.DisplayInstallationState, cl.DisplayInstallationStatus, tp.Format(cl.Status.Modified)} } return printer.PrintTable(p.Out, displayInstallations, row, - "NAMESPACE", "NAME", "CREATED", "MODIFIED", "LAST ACTION", "LAST STATUS") + "NAMESPACE", "NAME", "VERSION", "STATE", "STATUS", "MODIFIED") default: return fmt.Errorf("invalid format: %s", opts.Format) } } + +func setDisplayInstallationState(installation storage.Installation) string { + var state string + + if installation.IsInstalled() { + state = StateInstalled + } else if installation.IsUninstalled() { + state = StateUninstalled + } else if installation.IsDefined() { + state = StateDefined + } + + return state +} + +func setDisplayInstallationStatus(installation storage.Installation) string { + var status string + + switch installation.Status.ResultStatus { + case cnab.StatusSucceeded: + status = cnab.StatusSucceeded + case cnab.StatusFailed: + status = cnab.StatusFailed + case cnab.StatusRunning: + switch installation.Status.Action { + case cnab.ActionInstall: + status = StatusInstalling + case cnab.ActionUninstall: + status = StatusUninstalling + case cnab.ActionUpgrade: + status = StatusUpgrading + default: + status = fmt.Sprintf("running %s", installation.Status.Action) + } + } + + return status +} diff --git a/pkg/porter/testdata/show/expected-output.json b/pkg/porter/testdata/show/expected-output.json index 74e15467a..8d1ea4d74 100644 --- a/pkg/porter/testdata/show/expected-output.json +++ b/pkg/porter/testdata/show/expected-output.json @@ -53,5 +53,7 @@ "value": "top-secret" } ] - } + }, + "displayInstallationState": "installed", + "displayInstallationStatus": "succeeded" } diff --git a/pkg/porter/testdata/show/expected-output.yaml b/pkg/porter/testdata/show/expected-output.yaml index 1586f6903..822f1b3ec 100644 --- a/pkg/porter/testdata/show/expected-output.yaml +++ b/pkg/porter/testdata/show/expected-output.yaml @@ -40,3 +40,5 @@ _calculated: type: unknown sensitive: false value: top-secret +displayInstallationState: installed +displayInstallationStatus: succeeded diff --git a/pkg/storage/installation.go b/pkg/storage/installation.go index 2997e68b0..57495c924 100644 --- a/pkg/storage/installation.go +++ b/pkg/storage/installation.go @@ -222,6 +222,11 @@ func (i Installation) IsUninstalled() bool { return i.Status.Uninstalled != nil } +// IsDefined checks if the installation is has already been defined but not installed yet. +func (i Installation) IsDefined() bool { + return i.Status.Installed == nil +} + // OCIReferenceParts is our storage representation of cnab.OCIReference // with the parts explicitly stored separately so that they are queryable. type OCIReferenceParts struct { From a9d285d707e4658108b6d06153cb9a260bafc0cf Mon Sep 17 00:00:00 2001 From: Yingrong Zhao Date: Wed, 15 Jun 2022 21:21:14 -0400 Subject: [PATCH 06/23] fix archive folder test Signed-off-by: Yingrong Zhao Signed-off-by: joshuabezaleel --- pkg/porter/archive_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/porter/archive_test.go b/pkg/porter/archive_test.go index 7c6d949af..3a294c220 100644 --- a/pkg/porter/archive_test.go +++ b/pkg/porter/archive_test.go @@ -63,7 +63,7 @@ func TestArchive_ArchiveDirectory(t *testing.T) { dir, err := ex.createArchiveFolder("examples/test-bundle-0.2.0") require.NoError(t, err) - require.Contains(t, dir, "/tmp/examples-test-bundle-0.2.0") + require.Contains(t, dir, "examples-test-bundle-0.2.0") tests.AssertDirectoryPermissionsEqual(t, dir, pkg.FileModeDirectory) } From 601546220fff498c367813f0b63f354bad6f2cc8 Mon Sep 17 00:00:00 2001 From: Tanmay Chaudhry Date: Thu, 16 Jun 2022 16:13:49 +0200 Subject: [PATCH 07/23] Fix Vet Errors (#2153) * Fix lint errors for unkeyed fields in composite literals Signed-off-by: Tanmay Chaudhry * resolve lint errors on tags Signed-off-by: Tanmay Chaudhry * Updated golden file to account for bad struct tag fix Signed-off-by: Tanmay Chaudhry * Vet Fix: Rename example tests to use suffixes. Signed-off-by: Tanmay Chaudhry * Replace ExtendedBundle{} initialization with a NewBundle constructor Signed-off-by: Tanmay Chaudhry Signed-off-by: joshuabezaleel --- pkg/cache/cache_test.go | 8 +++--- pkg/cnab/cnab-to-oci/registry.go | 2 +- pkg/cnab/config-adapter/adapter.go | 4 +-- pkg/cnab/config-adapter/adapter_test.go | 4 +-- pkg/cnab/config-adapter/stamp_test.go | 8 +++--- pkg/cnab/dependencies_test.go | 18 ++++++------ pkg/cnab/docker_test.go | 6 ++-- pkg/cnab/extended_bundle.go | 7 ++++- pkg/cnab/extended_bundle_test.go | 16 +++++------ pkg/cnab/extensions_test.go | 4 +-- pkg/cnab/file_parameter_test.go | 6 ++-- pkg/cnab/helpers.go | 2 +- pkg/cnab/parameter_sources_test.go | 14 +++++----- pkg/cnab/provider/action.go | 4 +-- pkg/cnab/provider/credentials_test.go | 6 ++-- pkg/cnab/solver_test.go | 4 +-- pkg/generator/parameters_test.go | 8 +++--- pkg/plugins/pluggable/loader_test.go | 2 +- pkg/porter/dependencies.go | 2 +- .../examples/capture_output_example_test.go | 2 +- pkg/porter/examples/install_example_test.go | 2 +- pkg/porter/examples/pull_example_test.go | 2 +- pkg/porter/explain_test.go | 28 +++++++++---------- pkg/porter/helpers.go | 2 +- pkg/porter/lifecycle.go | 2 +- pkg/porter/list.go | 2 +- pkg/porter/outputs.go | 2 +- pkg/porter/outputs_test.go | 2 +- pkg/porter/parameters_test.go | 28 +++++++++---------- pkg/porter/publish.go | 2 +- pkg/porter/publish_test.go | 8 +++--- pkg/porter/reconcile.go | 2 +- pkg/porter/show.go | 2 +- pkg/porter/show_test.go | 4 +-- pkg/porter/testdata/show/expected-output.yaml | 2 +- pkg/runtime/runtime-manifest.go | 2 +- pkg/runtime/runtime-manifest_test.go | 28 +++++++++---------- pkg/runtime/runtime_test.go | 4 +-- pkg/storage/grpc_test.go | 28 +++++++++---------- pkg/storage/installation.go | 2 +- pkg/storage/installation_store.go | 18 ++++++------ pkg/storage/installation_store_test.go | 2 +- pkg/storage/pluginstore/grpc_test.go | 10 +++---- pkg/storage/query.go | 2 +- pkg/storage/query_test.go | 4 +-- pkg/storage/run.go | 24 ++++++++-------- 46 files changed, 173 insertions(+), 168 deletions(-) diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go index 31ac57b81..77c142779 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/cache/cache_test.go @@ -196,25 +196,25 @@ func TestStoreManifest(t *testing.T) { }{ { name: "embedded manifest", - bundle: cnab.ExtendedBundle{bundle.Bundle{ + bundle: cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ "sh.porter": map[string]interface{}{ "manifest": "bmFtZTogSEVMTE9fQ1VTVE9NCnZlcnNpb246IDAuMS4wCmRlc2NyaXB0aW9uOiAiQSBidW5kbGUgd2l0aCBhIGN1c3RvbSBhY3Rpb24iCnRhZzogZ2V0cG9ydGVyL3BvcnRlci1oZWxsbzp2MC4xLjAKaW52b2NhdGlvbkltYWdlOiBnZXRwb3J0ZXIvcG9ydGVyLWhlbGxvLWluc3RhbGxlcjowLjEuMAoKY3JlZGVudGlhbHM6CiAgLSBuYW1lOiBteS1maXJzdC1jcmVkCiAgICBlbnY6IE1ZX0ZJUlNUX0NSRUQKICAtIG5hbWU6IG15LXNlY29uZC1jcmVkCiAgICBkZXNjcmlwdGlvbjogIk15IHNlY29uZCBjcmVkIgogICAgcGF0aDogL3BhdGgvdG8vbXktc2Vjb25kLWNyZWQKCmltYWdlczogCiAgIHNvbWV0aGluZzoKICAgICAgZGVzY3JpcHRpb246ICJhbiBpbWFnZSIKICAgICAgaW1hZ2VUeXBlOiAiZG9ja2VyIgogICAgICByZXBvc2l0b3J5OiAiZ2V0cG9ydGVyL2JvbyIKCnBhcmFtZXRlcnM6CiAgLSBuYW1lOiBteS1maXJzdC1wYXJhbQogICAgdHlwZTogaW50ZWdlcgogICAgZGVmYXVsdDogOQogICAgZW52OiBNWV9GSVJTVF9QQVJBTQogICAgYXBwbHlUbzoKICAgICAgLSAiaW5zdGFsbCIKICAtIG5hbWU6IG15LXNlY29uZC1wYXJhbQogICAgZGVzY3JpcHRpb246ICJNeSBzZWNvbmQgcGFyYW1ldGVyIgogICAgdHlwZTogc3RyaW5nCiAgICBkZWZhdWx0OiBzcHJpbmctbXVzaWMtZGVtbwogICAgcGF0aDogL3BhdGgvdG8vbXktc2Vjb25kLXBhcmFtCiAgICBzZW5zaXRpdmU6IHRydWUKCm91dHB1dHM6CiAgLSBuYW1lOiBteS1maXJzdC1vdXRwdXQKICAgIHR5cGU6IHN0cmluZwogICAgYXBwbHlUbzoKICAgICAgLSAiaW5zdGFsbCIKICAgICAgLSAidXBncmFkZSIKICAgIHNlbnNpdGl2ZTogdHJ1ZQogIC0gbmFtZTogbXktc2Vjb25kLW91dHB1dAogICAgZGVzY3JpcHRpb246ICJNeSBzZWNvbmQgb3V0cHV0IgogICAgdHlwZTogYm9vbGVhbgogICAgc2Vuc2l0aXZlOiBmYWxzZQogIC0gbmFtZToga3ViZWNvbmZpZwogICAgdHlwZTogZmlsZQogICAgcGF0aDogL3Jvb3QvLmt1YmUvY29uZmlnCgptaXhpbnM6CiAgLSBleGVjCgppbnN0YWxsOgogIC0gZXhlYzoKICAgICAgZGVzY3JpcHRpb246ICJJbnN0YWxsIEhlbGxvIFdvcmxkIgogICAgICBjb21tYW5kOiBiYXNoCiAgICAgIGZsYWdzOgogICAgICAgIGM6IGVjaG8gSGVsbG8gV29ybGQKCnVwZ3JhZGU6CiAgLSBleGVjOgogICAgICBkZXNjcmlwdGlvbjogIldvcmxkIDIuMCIKICAgICAgY29tbWFuZDogYmFzaAogICAgICBmbGFnczoKICAgICAgICBjOiBlY2hvIFdvcmxkIDIuMAoKem9tYmllczoKICAtIGV4ZWM6CiAgICAgIGRlc2NyaXB0aW9uOiAiVHJpZ2dlciB6b21iaWUgYXBvY2FseXBzZSIKICAgICAgY29tbWFuZDogYmFzaAogICAgICBmbGFnczoKICAgICAgICBjOiBlY2hvIG9oIG5vZXMgbXkgYnJhaW5zCgp1bmluc3RhbGw6CiAgLSBleGVjOgogICAgICBkZXNjcmlwdGlvbjogIlVuaW5zdGFsbCBIZWxsbyBXb3JsZCIKICAgICAgY29tbWFuZDogYmFzaAogICAgICBmbGFnczoKICAgICAgICBjOiBlY2hvIEdvb2RieWUgV29ybGQK", }, }, - }}, + }), tag: kahn1dot01, shouldCacheManifest: true, }, { name: "porter stamp, no manifest", - bundle: cnab.ExtendedBundle{bundle.Bundle{ + bundle: cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ "sh.porter": map[string]interface{}{ "manifestDigest": "abc123", }, }, - }}, + }), tag: kahn1dot01, shouldCacheManifest: false, }, diff --git a/pkg/cnab/cnab-to-oci/registry.go b/pkg/cnab/cnab-to-oci/registry.go index 2d77ff894..2999124a4 100644 --- a/pkg/cnab/cnab-to-oci/registry.go +++ b/pkg/cnab/cnab-to-oci/registry.go @@ -76,7 +76,7 @@ func (r *Registry) PullBundle(ref cnab.OCIReference, insecureRegistry bool) (cna bundleRef := cnab.BundleReference{ Reference: ref, Digest: digest, - Definition: cnab.ExtendedBundle{*bun}, + Definition: cnab.NewBundle(*bun), RelocationMap: reloMap, } diff --git a/pkg/cnab/config-adapter/adapter.go b/pkg/cnab/config-adapter/adapter.go index 32c281222..98f6f3e80 100644 --- a/pkg/cnab/config-adapter/adapter.go +++ b/pkg/cnab/config-adapter/adapter.go @@ -48,14 +48,14 @@ func (c *ManifestConverter) ToBundle(ctx context.Context) (cnab.ExtendedBundle, return cnab.ExtendedBundle{}, span.Error(err) } - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ SchemaVersion: SchemaVersion, Name: c.Manifest.Name, Description: c.Manifest.Description, Version: c.Manifest.Version, Maintainers: c.generateBundleMaintainers(), Custom: make(map[string]interface{}, 1), - }} + }) image := bundle.InvocationImage{ BaseImage: bundle.BaseImage{ Image: c.Manifest.Image, diff --git a/pkg/cnab/config-adapter/adapter_test.go b/pkg/cnab/config-adapter/adapter_test.go index 8f75a5bd5..13ee026a2 100644 --- a/pkg/cnab/config-adapter/adapter_test.go +++ b/pkg/cnab/config-adapter/adapter_test.go @@ -659,7 +659,7 @@ func TestNewManifestConverter_generateOutputWiringParameter(t *testing.T) { outputDef := definition.Schema{ Type: "string", } - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Outputs: map[string]bundle.Output{ "msg": { Definition: "stringDef", @@ -671,7 +671,7 @@ func TestNewManifestConverter_generateOutputWiringParameter(t *testing.T) { Definitions: map[string]*definition.Schema{ "stringDef": &outputDef, }, - }} + }) t.Run("generate parameter", func(t *testing.T) { t.Parallel() diff --git a/pkg/cnab/config-adapter/stamp_test.go b/pkg/cnab/config-adapter/stamp_test.go index d39fb1a0c..a9a3526c6 100644 --- a/pkg/cnab/config-adapter/stamp_test.go +++ b/pkg/cnab/config-adapter/stamp_test.go @@ -50,7 +50,7 @@ func TestConfig_GenerateStamp(t *testing.T) { func TestConfig_LoadStamp(t *testing.T) { t.Parallel() - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ config.CustomPorterKey: map[string]interface{}{ "manifestDigest": "somedigest", @@ -60,7 +60,7 @@ func TestConfig_LoadStamp(t *testing.T) { }, }, }, - }} + }) stamp, err := LoadStamp(bun) require.NoError(t, err) @@ -72,13 +72,13 @@ func TestConfig_LoadStamp(t *testing.T) { func TestConfig_LoadStamp_Invalid(t *testing.T) { t.Parallel() - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ config.CustomPorterKey: []string{ "somedigest", }, }, - }} + }) stamp, err := LoadStamp(bun) require.Error(t, err) diff --git a/pkg/cnab/dependencies_test.go b/pkg/cnab/dependencies_test.go index 327116308..0c12694a4 100644 --- a/pkg/cnab/dependencies_test.go +++ b/pkg/cnab/dependencies_test.go @@ -18,7 +18,7 @@ func TestReadDependencyProperties(t *testing.T) { b, err := bundle.Unmarshal(data) require.NoError(t, err, "could not unmarshal the bundle") - bun := ExtendedBundle{*b} + bun := NewBundle(*b) assert.True(t, bun.HasDependencies()) deps, err := bun.ReadDependencies() @@ -44,7 +44,7 @@ func TestDependencies_ListBySequence(t *testing.T) { sequenceMock := []string{"nginx", "storage", "mysql"} - bun := ExtendedBundle{bundle.Bundle{ + bun := NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ DependenciesExtensionKey: Dependencies{ Sequence: sequenceMock, @@ -68,7 +68,7 @@ func TestDependencies_ListBySequence(t *testing.T) { }, }, }, - }} + }) rawDeps, err := bun.ReadDependencies() orderedDeps := rawDeps.ListBySequence() @@ -92,9 +92,9 @@ func TestSupportsDependencies(t *testing.T) { t.Parallel() t.Run("supported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{DependenciesExtensionKey}, - }} + }) assert.True(t, b.SupportsDependencies()) }) @@ -109,19 +109,19 @@ func TestHasDependencies(t *testing.T) { t.Parallel() t.Run("has dependencies", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{DependenciesExtensionKey}, Custom: map[string]interface{}{ DependenciesExtensionKey: struct{}{}, }, - }} + }) assert.True(t, b.HasDependencies()) }) t.Run("no dependencies", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{DependenciesExtensionKey}, - }} + }) assert.False(t, b.HasDependencies()) }) diff --git a/pkg/cnab/docker_test.go b/pkg/cnab/docker_test.go index 83f563256..59338725e 100644 --- a/pkg/cnab/docker_test.go +++ b/pkg/cnab/docker_test.go @@ -55,14 +55,14 @@ func TestSupportsDocker(t *testing.T) { t.Parallel() t.Run("supported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{DockerExtensionKey}, - }} + }) assert.True(t, b.SupportsDocker()) }) t.Run("unsupported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{}} + b := NewBundle(bundle.Bundle{}) assert.False(t, b.SupportsDocker()) }) diff --git a/pkg/cnab/extended_bundle.go b/pkg/cnab/extended_bundle.go index 16f45de70..04d3a13b1 100644 --- a/pkg/cnab/extended_bundle.go +++ b/pkg/cnab/extended_bundle.go @@ -17,6 +17,11 @@ type ExtendedBundle struct { bundle.Bundle } +// NewBundle creates an ExtendedBundle from a given bundle. +func NewBundle(bundle bundle.Bundle) ExtendedBundle { + return ExtendedBundle{bundle} +} + // LoadBundle from the specified filepath. func LoadBundle(c *portercontext.Context, bundleFile string) (ExtendedBundle, error) { bunD, err := c.FileSystem.ReadFile(bundleFile) @@ -29,7 +34,7 @@ func LoadBundle(c *portercontext.Context, bundleFile string) (ExtendedBundle, er return ExtendedBundle{}, errors.Wrapf(err, "cannot load bundle from\n%s at %s", string(bunD), bundleFile) } - return ExtendedBundle{*bun}, nil + return NewBundle(*bun), nil } // IsPorterBundle determines if the bundle was created by Porter. diff --git a/pkg/cnab/extended_bundle_test.go b/pkg/cnab/extended_bundle_test.go index 37cb04a23..b53c22e6d 100644 --- a/pkg/cnab/extended_bundle_test.go +++ b/pkg/cnab/extended_bundle_test.go @@ -11,11 +11,11 @@ import ( func TestExtendedBundle_IsPorterBundle(t *testing.T) { t.Run("made by porter", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ "sh.porter": struct{}{}, }, - }} + }) assert.True(t, b.IsPorterBundle()) }) @@ -35,7 +35,7 @@ func TestExtendedBundle_IsFileType(t *testing.T) { Type: "string", ContentEncoding: "base64", } - bun := ExtendedBundle{bundle.Bundle{ + bun := NewBundle(bundle.Bundle{ RequiredExtensions: []string{ FileParameterExtensionKey, }, @@ -52,7 +52,7 @@ func TestExtendedBundle_IsFileType(t *testing.T) { Definition: "file", }, }, - }} + }) assert.False(t, bun.IsFileType(stringDef), "strings should not be flagged as files") assert.True(t, bun.IsFileType(fileDef), "strings+base64 with the file-parameters extension should be categorized as files") @@ -70,7 +70,7 @@ func TestExtendedBundle_IsFileType(t *testing.T) { } func TestExtendedBundle_IsInternalParameter(t *testing.T) { - bun := ExtendedBundle{bundle.Bundle{ + bun := NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "foo": &definition.Schema{ Type: "string", @@ -91,7 +91,7 @@ func TestExtendedBundle_IsInternalParameter(t *testing.T) { Definition: "porter-debug", }, }, - }} + }) t.Run("empty bundle", func(t *testing.T) { b := ExtendedBundle{} @@ -117,7 +117,7 @@ func TestExtendedBundle_IsInternalParameter(t *testing.T) { func TestExtendedBundle_IsSensitiveParameter(t *testing.T) { sensitive := true - bun := ExtendedBundle{bundle.Bundle{ + bun := NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "foo": &definition.Schema{ Type: "string", @@ -139,7 +139,7 @@ func TestExtendedBundle_IsSensitiveParameter(t *testing.T) { Definition: "porter-debug", }, }, - }} + }) t.Run("empty bundle", func(t *testing.T) { b := ExtendedBundle{} diff --git a/pkg/cnab/extensions_test.go b/pkg/cnab/extensions_test.go index 8fc99b132..4045244d6 100644 --- a/pkg/cnab/extensions_test.go +++ b/pkg/cnab/extensions_test.go @@ -9,13 +9,13 @@ import ( func TestSupportsExtension(t *testing.T) { t.Run("key present", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{RequiredExtensions: []string{"io.test.thing"}}} + b := NewBundle(bundle.Bundle{RequiredExtensions: []string{"io.test.thing"}}) assert.True(t, b.SupportsExtension("io.test.thing")) }) t.Run("key missing", func(t *testing.T) { // We need to match against the full key, not just shorthand - b := ExtendedBundle{bundle.Bundle{RequiredExtensions: []string{"thing"}}} + b := NewBundle(bundle.Bundle{RequiredExtensions: []string{"thing"}}) assert.False(t, b.SupportsExtension("io.test.thing")) }) } diff --git a/pkg/cnab/file_parameter_test.go b/pkg/cnab/file_parameter_test.go index 8b8565d9e..3ac831270 100644 --- a/pkg/cnab/file_parameter_test.go +++ b/pkg/cnab/file_parameter_test.go @@ -35,14 +35,14 @@ func TestSupportsFileParameters(t *testing.T) { t.Parallel() t.Run("supported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{FileParameterExtensionKey}, - }} + }) assert.True(t, b.SupportsFileParameters()) }) t.Run("unsupported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{}} + b := NewBundle(bundle.Bundle{}) assert.False(t, b.SupportsFileParameters()) }) diff --git a/pkg/cnab/helpers.go b/pkg/cnab/helpers.go index 020cdbd50..5c330351f 100644 --- a/pkg/cnab/helpers.go +++ b/pkg/cnab/helpers.go @@ -15,5 +15,5 @@ func ReadTestBundle(t *testing.T, path string) ExtendedBundle { bun, err := bundle.Unmarshal(bunD) require.NoError(t, err, "Unmarshal failed for bundle at %s", path) - return ExtendedBundle{*bun} + return NewBundle(*bun) } diff --git a/pkg/cnab/parameter_sources_test.go b/pkg/cnab/parameter_sources_test.go index 6ee613fe5..228878c53 100644 --- a/pkg/cnab/parameter_sources_test.go +++ b/pkg/cnab/parameter_sources_test.go @@ -60,7 +60,7 @@ func TestReadParameterSourcesProperties(t *testing.T) { b, err := bundle.Unmarshal(data) require.NoError(t, err, "could not unmarshal the bundle") - bun := ExtendedBundle{*b} + bun := NewBundle(*b) assert.True(t, bun.HasParameterSources()) ps, err := bun.ReadParameterSources() @@ -88,9 +88,9 @@ func TestSupportsParameterSources(t *testing.T) { t.Parallel() t.Run("supported", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{ParameterSourcesExtensionKey}, - }} + }) assert.True(t, b.SupportsParameterSources()) }) @@ -105,19 +105,19 @@ func TestHasParameterSources(t *testing.T) { t.Parallel() t.Run("has parameter sources", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{ParameterSourcesExtensionKey}, Custom: map[string]interface{}{ ParameterSourcesExtensionKey: struct{}{}, }, - }} + }) assert.True(t, b.HasParameterSources()) }) t.Run("no parameter sources", func(t *testing.T) { - b := ExtendedBundle{bundle.Bundle{ + b := NewBundle(bundle.Bundle{ RequiredExtensions: []string{ParameterSourcesExtensionKey}, - }} + }) assert.False(t, b.HasParameterSources()) }) diff --git a/pkg/cnab/provider/action.go b/pkg/cnab/provider/action.go index ddf4c017d..d0f257f71 100644 --- a/pkg/cnab/provider/action.go +++ b/pkg/cnab/provider/action.go @@ -198,7 +198,7 @@ func (r *Runtime) CreateRun(ctx context.Context, args ActionArguments, b cnab.Ex currentRun.BundleDigest = args.BundleReference.Digest.String() var err error - extb := cnab.ExtendedBundle{b.Bundle} + extb := cnab.NewBundle(b.Bundle) currentRun.Parameters.Parameters, err = r.sanitizer.CleanRawParameters(ctx, args.Params, extb, currentRun.ID) if err != nil { return storage.Run{}, span.Error(err) @@ -271,7 +271,7 @@ func (r *Runtime) SaveOperationResult(ctx context.Context, opResult driver.Opera for outputName, outputValue := range opResult.Outputs { output := result.NewOutput(outputName, []byte(outputValue)) - output, err = r.sanitizer.CleanOutput(ctx, output, cnab.ExtendedBundle{run.Bundle}) + output, err = r.sanitizer.CleanOutput(ctx, output, cnab.ExtendedBundle{Bundle: run.Bundle}) if err != nil { bigerr = multierror.Append(bigerr, errors.Wrapf(err, "error sanitizing sensitive %s output for %s run of installation %s\n%#v", output.Name, run.Action, installation, output)) } diff --git a/pkg/cnab/provider/credentials_test.go b/pkg/cnab/provider/credentials_test.go index 4f7004bc9..8a03effaf 100644 --- a/pkg/cnab/provider/credentials_test.go +++ b/pkg/cnab/provider/credentials_test.go @@ -34,7 +34,7 @@ func TestRuntime_loadCredentials(t *testing.T) { err := r.credentials.InsertCredentialSet(context.Background(), cs1) require.NoError(t, err, "Save credential set failed") - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Credentials: map[string]bundle.Credential{ "password": { Location: bundle.Location{ @@ -47,7 +47,7 @@ func TestRuntime_loadCredentials(t *testing.T) { }, }, }, - }} + }) args := ActionArguments{Installation: storage.Installation{CredentialSets: []string{"mycreds"}}, Action: "install"} gotValues, err := r.loadCredentials(context.Background(), b, args) @@ -65,7 +65,7 @@ func TestRuntime_loadCredentials(t *testing.T) { func TestRuntime_loadCredentials_WithApplyTo(t *testing.T) { getBundle := func(required bool) cnab.ExtendedBundle { - return cnab.ExtendedBundle{bundle.Bundle{ + return cnab.ExtendedBundle{Bundle: bundle.Bundle{ Credentials: map[string]bundle.Credential{ "password": { Location: bundle.Location{ diff --git a/pkg/cnab/solver_test.go b/pkg/cnab/solver_test.go index 7bb4018f9..c211f565a 100644 --- a/pkg/cnab/solver_test.go +++ b/pkg/cnab/solver_test.go @@ -11,7 +11,7 @@ import ( func TestDependencySolver_ResolveDependencies(t *testing.T) { t.Parallel() - bun := ExtendedBundle{bundle.Bundle{ + bun := NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ DependenciesExtensionKey: Dependencies{ Requires: map[string]Dependency{ @@ -24,7 +24,7 @@ func TestDependencySolver_ResolveDependencies(t *testing.T) { }, }, }, - }} + }) s := DependencySolver{} locks, err := s.ResolveDependencies(bun) diff --git a/pkg/generator/parameters_test.go b/pkg/generator/parameters_test.go index 2536f3560..9743f8e52 100644 --- a/pkg/generator/parameters_test.go +++ b/pkg/generator/parameters_test.go @@ -33,7 +33,7 @@ func TestGoodParametersName(t *testing.T) { Name: name, Silent: true, }, - Bundle: cnab.ExtendedBundle{bundle.Bundle{ + Bundle: cnab.NewBundle(bundle.Bundle{ Parameters: map[string]bundle.Parameter{ "one": { Definition: "one", @@ -46,7 +46,7 @@ func TestGoodParametersName(t *testing.T) { }, }, }, - }} + )} pset, err := opts.GenerateParameters() require.NoError(t, err, "name should NOT have resulted in an error") @@ -98,7 +98,7 @@ func TestSkipParameters(t *testing.T) { Name: name, Silent: true, }, - Bundle: cnab.ExtendedBundle{bundle.Bundle{ + Bundle: cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "porter-debug": &definition.Schema{ Comment: cnab.PorterInternal, @@ -110,7 +110,7 @@ func TestSkipParameters(t *testing.T) { }, }, }, - }} + )} pset, err := opts.GenerateParameters() require.NoError(t, err, "parameters generation should not have resulted in an error") diff --git a/pkg/plugins/pluggable/loader_test.go b/pkg/plugins/pluggable/loader_test.go index 882678a12..10b188962 100644 --- a/pkg/plugins/pluggable/loader_test.go +++ b/pkg/plugins/pluggable/loader_test.go @@ -51,7 +51,7 @@ func TestPluginLoader_SelectPlugin(t *testing.T) { c.Data.DefaultStorage = "azure" c.Data.StoragePlugins = []config.StoragePlugin{ { - config.PluginConfig{ + PluginConfig: config.PluginConfig{ Name: "azure", PluginSubKey: "azure.blob", Config: map[string]interface{}{ diff --git a/pkg/porter/dependencies.go b/pkg/porter/dependencies.go index 28a580223..abf5682ba 100644 --- a/pkg/porter/dependencies.go +++ b/pkg/porter/dependencies.go @@ -141,7 +141,7 @@ func (e *dependencyExecutioner) identifyDependencies(ctx context.Context) error return err } - bun = cnab.ExtendedBundle{c.Bundle} + bun = cnab.NewBundle(c.Bundle) } else { // If we hit here, there is a bug somewhere return errors.New("identifyDependencies failed to load the bundle because no bundle was specified. Please report this bug to https://github.com/getporter/porter/issues/new/choose") diff --git a/pkg/porter/examples/capture_output_example_test.go b/pkg/porter/examples/capture_output_example_test.go index ca36d77bb..317ec2ddf 100644 --- a/pkg/porter/examples/capture_output_example_test.go +++ b/pkg/porter/examples/capture_output_example_test.go @@ -9,7 +9,7 @@ import ( "get.porter.sh/porter/pkg/porter" ) -func ExampleCaptureOutput() { +func ExamplePorter_captureOutput() { // Create an instance of the Porter application p := porter.New() diff --git a/pkg/porter/examples/install_example_test.go b/pkg/porter/examples/install_example_test.go index bf33fb2c8..5675d0bb2 100644 --- a/pkg/porter/examples/install_example_test.go +++ b/pkg/porter/examples/install_example_test.go @@ -8,7 +8,7 @@ import ( "get.porter.sh/porter/pkg/porter" ) -func ExampleInstall() { +func ExamplePorter_install() { // Create an instance of the Porter application p := porter.New() diff --git a/pkg/porter/examples/pull_example_test.go b/pkg/porter/examples/pull_example_test.go index 1241dd0d2..bcc858a96 100644 --- a/pkg/porter/examples/pull_example_test.go +++ b/pkg/porter/examples/pull_example_test.go @@ -7,7 +7,7 @@ import ( "get.porter.sh/porter/pkg/porter" ) -func ExamplePullBundle() { +func ExamplePorter_pullBundle() { // Create an instance of the Porter application p := porter.New() diff --git a/pkg/porter/explain_test.go b/pkg/porter/explain_test.go index 152779dbd..6a32e3d1b 100644 --- a/pkg/porter/explain_test.go +++ b/pkg/porter/explain_test.go @@ -110,7 +110,7 @@ func TestExplain_generateYAML(t *testing.T) { } func TestExplain_generatePrintableBundleParams(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ RequiredExtensions: []string{ cnab.FileParameterExtensionKey, }, @@ -140,7 +140,7 @@ func TestExplain_generatePrintableBundleParams(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) pb, err := generatePrintable(bun, "") require.NoError(t, err) @@ -160,7 +160,7 @@ func TestExplain_generatePrintableBundleParams(t *testing.T) { } func TestExplain_generatePrintableBundleParamsWithAction(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ RequiredExtensions: []string{ cnab.FileParameterExtensionKey, }, @@ -191,7 +191,7 @@ func TestExplain_generatePrintableBundleParamsWithAction(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) t.Run("action applies", func(t *testing.T) { pb, err := generatePrintable(bun, "install") @@ -233,7 +233,7 @@ func TestExplain_generatePrintableBundleParamsWithAction(t *testing.T) { } func TestExplain_generatePrintableBundleOutputs(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "string": &definition.Schema{ Type: "string", @@ -256,7 +256,7 @@ func TestExplain_generatePrintableBundleOutputs(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) pb, err := generatePrintable(bun, "") require.NoError(t, err) @@ -288,7 +288,7 @@ func TestExplain_generatePrintableBundleOutputs(t *testing.T) { } func TestExplain_generatePrintableBundleCreds(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Credentials: map[string]bundle.Credential{ "kubeconfig": { Required: true, @@ -306,7 +306,7 @@ func TestExplain_generatePrintableBundleCreds(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) t.Run("action applies", func(t *testing.T) { pb, err := generatePrintable(bun, "install") @@ -348,7 +348,7 @@ func TestExplain_generatePrintableBundleCreds(t *testing.T) { } func TestExplain_generatePrintableBundlePorterVersion(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "string": &definition.Schema{ Type: "string", @@ -362,7 +362,7 @@ func TestExplain_generatePrintableBundlePorterVersion(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) pb, err := generatePrintable(bun, "") assert.NoError(t, err) @@ -371,14 +371,14 @@ func TestExplain_generatePrintableBundlePorterVersion(t *testing.T) { } func TestExplain_generatePrintableBundlePorterVersionNonPorterBundle(t *testing.T) { - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "string": &definition.Schema{ Type: "string", Default: "clippy", }, }, - }} + }) pb, err := generatePrintable(bun, "") assert.NoError(t, err) @@ -389,7 +389,7 @@ func TestExplain_generatePrintableBundlePorterVersionNonPorterBundle(t *testing. func TestExplain_generatePrintableBundleDependencies(t *testing.T) { sequenceMock := []string{"nginx", "storage", "mysql"} - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ cnab.DependenciesExtensionKey: cnab.Dependencies{ Sequence: sequenceMock, @@ -414,7 +414,7 @@ func TestExplain_generatePrintableBundleDependencies(t *testing.T) { "commit": "3b7c85ba", }, }, - }} + }) pd, err := generatePrintable(bun, "") assert.NoError(t, err) diff --git a/pkg/porter/helpers.go b/pkg/porter/helpers.go index d2bc539e4..f97cb4425 100644 --- a/pkg/porter/helpers.go +++ b/pkg/porter/helpers.go @@ -182,7 +182,7 @@ func (p *TestPorter) ReadBundle(path string) cnab.ExtendedBundle { bun, err := bundle.Unmarshal(bunD) require.NoError(p.T(), err, "Unmarshal failed for bundle at %s", path) - return cnab.ExtendedBundle{*bun} + return cnab.NewBundle(*bun) } func (p *TestPorter) RandomString(len int) string { diff --git a/pkg/porter/lifecycle.go b/pkg/porter/lifecycle.go index edfbfde58..7a61816f6 100644 --- a/pkg/porter/lifecycle.go +++ b/pkg/porter/lifecycle.go @@ -140,7 +140,7 @@ func (p *Porter) resolveBundleReference(ctx context.Context, opts *BundleActionO } bundleRef = cnab.BundleReference{ - Definition: cnab.ExtendedBundle{lastRun.Bundle}, + Definition: cnab.NewBundle(lastRun.Bundle), Digest: digest.Digest(lastRun.BundleDigest)} if lastRun.BundleReference != "" { diff --git a/pkg/porter/list.go b/pkg/porter/list.go index bf083ad98..1476c52ab 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -118,7 +118,7 @@ type DisplayInstallation struct { } type DisplayInstallationMetadata struct { - ResolvedParameters DisplayValues `json:"resolvedParameters", yaml:"resolvedParameters"` + ResolvedParameters DisplayValues `json:"resolvedParameters" yaml:"resolvedParameters"` } func NewDisplayInstallation(installation storage.Installation) DisplayInstallation { diff --git a/pkg/porter/outputs.go b/pkg/porter/outputs.go index 94a852811..1570748fa 100644 --- a/pkg/porter/outputs.go +++ b/pkg/porter/outputs.go @@ -135,7 +135,7 @@ func (p *Porter) ListBundleOutputs(ctx context.Context, opts *OutputListOptions) return nil, err } - bun := cnab.ExtendedBundle{c.Bundle} + bun := cnab.NewBundle(c.Bundle) displayOutputs := NewDisplayValuesFromOutputs(bun, resolved) if err != nil { diff --git a/pkg/porter/outputs_test.go b/pkg/porter/outputs_test.go index a4dafa131..43999c622 100644 --- a/pkg/porter/outputs_test.go +++ b/pkg/porter/outputs_test.go @@ -103,7 +103,7 @@ func TestPorter_PrintBundleOutputs(t *testing.T) { }, } - extB := cnab.ExtendedBundle{b} + extB := cnab.NewBundle(b) i := p.TestInstallations.CreateInstallation(storage.NewInstallation("", "test"), func(i *storage.Installation) { i.Parameters.Parameters = p.SanitizeParameters(i.Parameters.Parameters, i.ID, extB) }) diff --git a/pkg/porter/parameters_test.go b/pkg/porter/parameters_test.go index 9186e4ddd..9d02726d7 100644 --- a/pkg/porter/parameters_test.go +++ b/pkg/porter/parameters_test.go @@ -99,9 +99,9 @@ func Test_loadParameters_paramNotDefined(t *testing.T) { r := NewTestPorter(t) defer r.Close() - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Parameters: map[string]bundle.Parameter{}, - }} + }) overrides := map[string]string{ "foo": "bar", @@ -118,13 +118,13 @@ func Test_loadParameters_definitionNotDefined(t *testing.T) { r := NewTestPorter(t) defer r.Close() - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Parameters: map[string]bundle.Parameter{ "foo": { Definition: "foo", }, }, - }} + }) overrides := map[string]string{ "foo": "bar", @@ -143,7 +143,7 @@ func Test_loadParameters_applyTo(t *testing.T) { // Here we set default values, but expect nil/empty // values for parameters that do not apply to a given action - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "foo": &definition.Schema{ Type: "string", @@ -175,7 +175,7 @@ func Test_loadParameters_applyTo(t *testing.T) { }, }, }, - }} + }) overrides := map[string]string{ "foo": "FOO", @@ -198,7 +198,7 @@ func Test_loadParameters_applyToBundleDefaults(t *testing.T) { r := NewTestPorter(t) defer r.Close() - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "foo": &definition.Schema{ Type: "string", @@ -213,7 +213,7 @@ func Test_loadParameters_applyToBundleDefaults(t *testing.T) { }, }, }, - }} + }) i := storage.Installation{} params, err := r.resolveParameters(context.Background(), i, b, "action", nil) @@ -228,7 +228,7 @@ func Test_loadParameters_requiredButDoesNotApply(t *testing.T) { r := NewTestPorter(t) defer r.Close() - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ Definitions: definition.Definitions{ "foo": &definition.Schema{ Type: "string", @@ -243,7 +243,7 @@ func Test_loadParameters_requiredButDoesNotApply(t *testing.T) { Required: true, }, }, - }} + }) i := storage.Installation{} params, err := r.resolveParameters(context.Background(), i, b, "action", nil) @@ -260,7 +260,7 @@ func Test_loadParameters_fileParameter(t *testing.T) { r.TestConfig.TestContext.AddTestFile("testdata/file-param", "/path/to/file") - b := cnab.ExtendedBundle{bundle.Bundle{ + b := cnab.NewBundle(bundle.Bundle{ RequiredExtensions: []string{ cnab.FileParameterExtensionKey, }, @@ -279,7 +279,7 @@ func Test_loadParameters_fileParameter(t *testing.T) { }, }, }, - }} + }) overrides := map[string]string{ "foo": "/path/to/file", @@ -527,7 +527,7 @@ func Test_Paramapalooza(t *testing.T) { r := NewTestPorter(t) defer r.Close() - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Name: "mybuns", Version: "1.0.0", SchemaVersion: "v1.0.0", @@ -558,7 +558,7 @@ func Test_Paramapalooza(t *testing.T) { }, }, }, - }} + }) if tc.DefaultExists { bun.Definitions["my-param"].Default = "my-param-default" diff --git a/pkg/porter/publish.go b/pkg/porter/publish.go index 0e53e698d..8f9cf7dae 100644 --- a/pkg/porter/publish.go +++ b/pkg/porter/publish.go @@ -296,7 +296,7 @@ func (p *Porter) extractBundle(tmpDir, source string) (cnab.ExtendedBundle, erro return cnab.ExtendedBundle{}, errors.Wrapf(err, "failed to load bundle from archive %s", source) } - return cnab.ExtendedBundle{*bun}, nil + return cnab.NewBundle(*bun), nil } // pushUpdatedImage uses the provided layout to find the provided origImg, diff --git a/pkg/porter/publish_test.go b/pkg/porter/publish_test.go index 0596fb528..1a23570f0 100644 --- a/pkg/porter/publish_test.go +++ b/pkg/porter/publish_test.go @@ -149,7 +149,7 @@ func TestPublish_UpdateBundleWithNewImage(t *testing.T) { p := NewTestPorter(t) defer p.Close() - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Name: "mybuns", InvocationImages: []bundle.InvocationImage{ { @@ -167,7 +167,7 @@ func TestPublish_UpdateBundleWithNewImage(t *testing.T) { }, }, }, - }} + }) tag := "myneworg/mynewbuns" digest, err := image.NewDigest("sha256:6b5a28ccbb76f12ce771a23757880c6083234255c5ba191fca1c5db1f71c1687") @@ -198,7 +198,7 @@ func TestPublish_RefreshCachedBundle(t *testing.T) { bundleRef := cnab.BundleReference{ Reference: cnab.MustParseOCIReference("myreg/mybuns"), - Definition: cnab.ExtendedBundle{bundle.Bundle{Name: "myreg/mybuns"}}, + Definition: cnab.NewBundle(bundle.Bundle{Name: "myreg/mybuns"}), } // No-Op; bundle does not yet exist in cache @@ -234,7 +234,7 @@ func TestPublish_RefreshCachedBundle_OnlyWarning(t *testing.T) { bundleRef := cnab.BundleReference{ Reference: cnab.MustParseOCIReference("myreg/mybuns"), - Definition: cnab.ExtendedBundle{bundle.Bundle{Name: "myreg/mybuns"}}, + Definition: cnab.NewBundle(bundle.Bundle{Name: "myreg/mybuns"}), } p.TestCache.FindBundleMock = func(ref cnab.OCIReference) (cachedBundle cache.CachedBundle, found bool, err error) { diff --git a/pkg/porter/reconcile.go b/pkg/porter/reconcile.go index 39856ac87..8c0883ec5 100644 --- a/pkg/porter/reconcile.go +++ b/pkg/porter/reconcile.go @@ -221,7 +221,7 @@ func (p *Porter) IsInstallationInSync(ctx context.Context, i storage.Installatio return compParams, nil } - lastRunParams, err := p.Sanitizer.RestoreParameterSet(ctx, lastRun.Parameters, cnab.ExtendedBundle{lastRun.Bundle}) + lastRunParams, err := p.Sanitizer.RestoreParameterSet(ctx, lastRun.Parameters, cnab.NewBundle(lastRun.Bundle)) if err != nil { return false, err } diff --git a/pkg/porter/show.go b/pkg/porter/show.go index b529e4607..e39c2e6fc 100644 --- a/pkg/porter/show.go +++ b/pkg/porter/show.go @@ -175,7 +175,7 @@ func (p *Porter) NewDisplayInstallationWithSecrets(ctx context.Context, installa displayInstallation := NewDisplayInstallation(installation) if run != nil { - bun := cnab.ExtendedBundle{run.Bundle} + bun := cnab.NewBundle(run.Bundle) installParams, err := p.Sanitizer.RestoreParameterSet(ctx, installation.Parameters, bun) if err != nil { return DisplayInstallation{}, err diff --git a/pkg/porter/show_test.go b/pkg/porter/show_test.go index 1a94d40a3..2759a4f84 100644 --- a/pkg/porter/show_test.go +++ b/pkg/porter/show_test.go @@ -83,7 +83,7 @@ func TestPorter_ShowInstallationWithBundle(t *testing.T) { }, } - bun := cnab.ExtendedBundle{b} + bun := cnab.NewBundle(b) i := p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues, func(i *storage.Installation) { if tc.ref != "" { i.TrackBundle(cnab.MustParseOCIReference(tc.ref)) @@ -198,7 +198,7 @@ func TestPorter_ShowInstallationWithoutRecordedRun(t *testing.T) { }, } - bun := cnab.ExtendedBundle{b} + bun := cnab.NewBundle(b) p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues, func(i *storage.Installation) { i.TrackBundle(cnab.MustParseOCIReference("getporter/wordpress:v0.1.0")) i.Labels = map[string]string{ diff --git a/pkg/porter/testdata/show/expected-output.yaml b/pkg/porter/testdata/show/expected-output.yaml index 822f1b3ec..5d0bc8604 100644 --- a/pkg/porter/testdata/show/expected-output.yaml +++ b/pkg/porter/testdata/show/expected-output.yaml @@ -27,7 +27,7 @@ status: bundleVersion: 0.1.0 bundleDigest: sha256:88d68ef0bdb9cedc6da3a8e341a33e5d2f8bb19d0cf7ec3f1060d3f9eb73cae9 _calculated: - resolvedparameters: + resolvedParameters: - name: logLevel type: integer sensitive: false diff --git a/pkg/runtime/runtime-manifest.go b/pkg/runtime/runtime-manifest.go index 2bd8cb40c..c99b73d7f 100644 --- a/pkg/runtime/runtime-manifest.go +++ b/pkg/runtime/runtime-manifest.go @@ -109,7 +109,7 @@ func (m *RuntimeManifest) loadDependencyDefinitions() error { return errors.Wrapf(err, "error unmarshaling bundle definition for dependency %s", dep.Name) } - m.bundles[dep.Name] = cnab.ExtendedBundle{*bun} + m.bundles[dep.Name] = cnab.NewBundle(*bun) } return nil diff --git a/pkg/runtime/runtime-manifest_test.go b/pkg/runtime/runtime-manifest_test.go index 9b86d0f64..57f30357c 100644 --- a/pkg/runtime/runtime-manifest_test.go +++ b/pkg/runtime/runtime-manifest_test.go @@ -140,11 +140,11 @@ func TestDependencyMetadataAvailableForTemplating(t *testing.T) { require.NoError(t, err, "LoadManifestFrom failed") rm := NewRuntimeManifest(c.Context, cnab.ActionInstall, m) rm.bundles = map[string]cnab.ExtendedBundle{ - "mysql": {bundle.Bundle{ + "mysql": cnab.NewBundle(bundle.Bundle{ Name: "Azure MySQL", Description: "Azure MySQL database as a service", Version: "v1.0.0", - }}, + }), } before, _ := yaml.Marshal(m.Install[0]) @@ -340,15 +340,15 @@ func TestResolveStep_DependencyOutput(t *testing.T) { ps := cnab.ParameterSources{} ps.SetParameterFromDependencyOutput("porter-mysql-password", "mysql", "password") ps.SetParameterFromDependencyOutput("porter-mysql-root-password", "mysql", "root-password") - rm.bundle = cnab.ExtendedBundle{bundle.Bundle{ + rm.bundle = cnab.NewBundle(bundle.Bundle{ Custom: map[string]interface{}{ cnab.ParameterSourcesExtensionKey: ps, }, RequiredExtensions: []string{cnab.ParameterSourcesExtensionKey}, - }} + }) rm.bundles = map[string]cnab.ExtendedBundle{ - "mysql": {bundle.Bundle{ + "mysql": cnab.NewBundle(bundle.Bundle{ Outputs: map[string]bundle.Output{ "password": { Definition: "password", @@ -361,7 +361,7 @@ func TestResolveStep_DependencyOutput(t *testing.T) { "password": {WriteOnly: makeBoolPtr(true)}, "root-password": {WriteOnly: makeBoolPtr(true)}, }, - }}, + }), } s := &manifest.Step{ @@ -858,11 +858,11 @@ func TestResolveImageWithUpdatedBundle(t *testing.T) { img := bundle.Image{} img.Image = "blah/ghost:latest" img.Digest = "sha256:75c495e5ce9c428d482973d72e3ce9925e1db304a97946c9aa0b540d7537e041" - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Images: map[string]bundle.Image{ "machine": img, }, - }} + }) reloMap := relocation.ImageRelocationMap{} @@ -888,11 +888,11 @@ func TestResolveImageWithUpdatedMismatchedBundle(t *testing.T) { img := bundle.Image{} img.Image = "blah/ghost:latest" img.Digest = "sha256:75c495e5ce9c428d482973d72e3ce9925e1db304a97946c9aa0b540d7537e041" - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Images: map[string]bundle.Image{ "ghost": img, }, - }} + }) reloMap := relocation.ImageRelocationMap{} @@ -918,11 +918,11 @@ func TestResolveImageWithRelo(t *testing.T) { img := bundle.Image{} img.Image = "gabrtv/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687" img.Digest = "sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687" - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Images: map[string]bundle.Image{ "machine": img, }, - }} + }) reloMap := relocation.ImageRelocationMap{ "gabrtv/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687": "my.registry/microservice@sha256:cca460afa270d4c527981ef9ca4989346c56cf9b20217dcea37df1ece8120687", @@ -950,11 +950,11 @@ func TestResolveImageRelocationNoMatch(t *testing.T) { img := bundle.Image{} img.Image = "deislabs/ghost:latest" img.Digest = "sha256:75c495e5ce9c428d482973d72e3ce9925e1db304a97946c9aa0b540d7537e041" - bun := cnab.ExtendedBundle{bundle.Bundle{ + bun := cnab.NewBundle(bundle.Bundle{ Images: map[string]bundle.Image{ "machine": img, }, - }} + }) reloMap := relocation.ImageRelocationMap{ "deislabs/nogood:latest": "cnabio/ghost:latest", diff --git a/pkg/runtime/runtime_test.go b/pkg/runtime/runtime_test.go index eba88d989..d1bb14101 100644 --- a/pkg/runtime/runtime_test.go +++ b/pkg/runtime/runtime_test.go @@ -258,7 +258,7 @@ func TestRuntimeManifest_ApplyUnboundBundleOutputs_File(t *testing.T) { }, } rm := NewRuntimeManifest(c.Context, cnab.ActionInstall, m) - rm.bundle = cnab.ExtendedBundle{bundle.Bundle{ + rm.bundle = cnab.NewBundle(bundle.Bundle{ Definitions: map[string]*definition.Schema{ tc.def.Name: &tc.def.Schema, }, @@ -268,7 +268,7 @@ func TestRuntimeManifest_ApplyUnboundBundleOutputs_File(t *testing.T) { Path: tc.def.Path, }, }, - }} + }) _, err := rm.FileSystem.Create(srcPath) require.NoError(t, err) diff --git a/pkg/storage/grpc_test.go b/pkg/storage/grpc_test.go index 951e3d6fd..575bacab6 100644 --- a/pkg/storage/grpc_test.go +++ b/pkg/storage/grpc_test.go @@ -41,7 +41,7 @@ func TestRoundTripDataOverGRPC(t *testing.T) { // Add an index to support filtering const collection = "things" err = client.EnsureIndex(ctx, plugins.EnsureIndexOptions{Indices: []plugins.Index{ - {Collection: collection, Keys: bson.D{{"namespace", 1}, {"name", 1}}}, + {Collection: collection, Keys: bson.D{{Key: "namespace", Value: 1}, {Key: "name", Value: 1}}}, }}) require.NoError(t, err) @@ -58,7 +58,7 @@ func TestRoundTripDataOverGRPC(t *testing.T) { results, err := client.Find(ctx, plugins.FindOptions{ Collection: collection, Filter: bson.M{"namespace": "dev"}, - Select: bson.D{{"name", 1}, {"namespace", 1}, {"_id", 0}}, + Select: bson.D{{Key: "name", Value: 1}, {Key: "namespace", Value: 1}, {Key: "_id", Value: 0}}, }) require.NoError(t, err) require.Len(t, results, 1) @@ -70,11 +70,11 @@ func TestRoundTripDataOverGRPC(t *testing.T) { opts := plugins.EnsureIndexOptions{ Indices: []plugins.Index{ // query most recent outputs by run (porter installation run show, when we list outputs) - {Collection: CollectionOutputs, Keys: bson.D{{"namespace", 1}, {"installation", 1}, {"-resultId", 1}}}, + {Collection: CollectionOutputs, Keys: bson.D{{Key: "namespace", Value: 1}, {Key: "installation", Value: 1}, {Key: "-resultId", Value: 1}}}, // query outputs by result (list) - {Collection: CollectionOutputs, Keys: bson.D{{"resultId", 1}, {"name", 1}}, Unique: true}, + {Collection: CollectionOutputs, Keys: bson.D{{Key: "resultId", Value: 1}, {Key: "name", Value: 1}}, Unique: true}, // query most recent outputs by name for an installation - {Collection: CollectionOutputs, Keys: bson.D{{"namespace", 1}, {"installation", 1}, {"name", 1}, {"-resultId", 1}}}, + {Collection: CollectionOutputs, Keys: bson.D{{Key: "namespace", Value: 1}, {Key: "installation", Value: 1}, {Key: "name", Value: 1}, {Key: "-resultId", Value: 1}}}, }, } @@ -94,21 +94,21 @@ func TestRoundTripDataOverGRPC(t *testing.T) { Collection: CollectionOutputs, Pipeline: []bson.D{ // List outputs by installation - {{"$match", bson.M{ + {{Key: "$match", Value: bson.M{ "namespace": "dev", "installation": "test", }}}, // Reverse sort them (newest on top) - {{"$sort", bson.D{ - {"namespace", 1}, - {"installation", 1}, - {"name", 1}, - {"resultId", -1}, + {{Key: "$sort", Value: bson.D{ + {Key: "namespace", Value: 1}, + {Key: "installation", Value: 1}, + {Key: "name", Value: 1}, + {Key: "resultId", Value: -1}, }}}, // Group them by output name and select the last value for each output - {{"$group", bson.D{ - {"_id", "$name"}, - {"lastOutput", bson.M{"$first": "$$ROOT"}}, + {{Key: "$group", Value: bson.D{ + {Key: "_id", Value: "$name"}, + {Key: "lastOutput", Value: bson.M{"$first": "$$ROOT"}}, }}}, }, }) diff --git a/pkg/storage/installation.go b/pkg/storage/installation.go index 57495c924..656550b5d 100644 --- a/pkg/storage/installation.go +++ b/pkg/storage/installation.go @@ -200,7 +200,7 @@ type InstallationStatus struct { // Uninstalled indicates if the installation has successfully completed the uninstall action. // Once that state is reached, Porter should not allow further stateful actions. - Uninstalled *time.Time `json:"uninstalled" yaml"uninstalled" toml:"uninstalled"` + Uninstalled *time.Time `json:"uninstalled" yaml:"uninstalled" toml:"uninstalled"` // BundleReference of the bundle that last altered the installation state. BundleReference string `json:"bundleReference" yaml:"bundleReference" toml:"bundleReference"` diff --git a/pkg/storage/installation_store.go b/pkg/storage/installation_store.go index bfda84df0..04cc62b6b 100644 --- a/pkg/storage/installation_store.go +++ b/pkg/storage/installation_store.go @@ -212,21 +212,21 @@ func (s InstallationStore) GetLastOutputs(ctx context.Context, namespace string, opts := AggregateOptions{ Pipeline: []bson.D{ // List outputs by installation - {{"$match", bson.M{ + {{Key: "$match", Value: bson.M{ "namespace": namespace, "installation": installation, }}}, // Reverse sort them (newest on top) - {{"$sort", bson.D{ - {"namespace", 1}, - {"installation", 1}, - {"name", 1}, - {"resultId", -1}, + {{Key: "$sort", Value: bson.D{ + {Key: "namespace", Value: 1}, + {Key: "installation", Value: 1}, + {Key: "name", Value: 1}, + {Key: "resultId", Value: -1}, }}}, // Group them by output name and select the last value for each output - {{"$group", bson.D{ - {"_id", "$name"}, - {"lastOutput", bson.M{"$first": "$$ROOT"}}, + {{Key: "$group", Value: bson.D{ + {Key: "_id", Value: "$name"}, + {Key: "lastOutput", Value: bson.M{"$first": "$$ROOT"}}, }}}, }, } diff --git a/pkg/storage/installation_store_test.go b/pkg/storage/installation_store_test.go index 6c2ecaa34..58b4c8f88 100644 --- a/pkg/storage/installation_store_test.go +++ b/pkg/storage/installation_store_test.go @@ -229,7 +229,7 @@ func TestInstallationStorageProvider_Installations(t *testing.T) { t.Run("FindInstallations - project results", func(t *testing.T) { opts := FindOptions{ - Select: bson.D{{"labels", false}}, + Select: bson.D{{Key: "labels", Value: false}}, Sort: []string{"-id"}, Filter: bson.M{ "labels.team": "red", diff --git a/pkg/storage/pluginstore/grpc_test.go b/pkg/storage/pluginstore/grpc_test.go index d4bb775a5..22e530944 100644 --- a/pkg/storage/pluginstore/grpc_test.go +++ b/pkg/storage/pluginstore/grpc_test.go @@ -64,9 +64,9 @@ func TestConvertBsonM(t *testing.T) { func TestConvertBsonD(t *testing.T) { src := bson.D{ - {"a", "1"}, - {"b", bson.D{ - {"c", 1}, + {Key: "a", Value: "1"}, + {Key: "b", Value: bson.D{ + {Key: "c", Value: 1}, }}, } @@ -74,8 +74,8 @@ func TestConvertBsonD(t *testing.T) { dest := AsOrderedMap(tmp, ConvertSliceToBsonD) wantDest := bson.D{ - {"a", "1"}, - {"b", bson.D{{"c", int64(1)}}}, + {Key: "a", Value: "1"}, + {Key: "b", Value: bson.D{{Key: "c", Value: int64(1)}}}, } require.Equal(t, wantDest, dest) } diff --git a/pkg/storage/query.go b/pkg/storage/query.go index f19dab6cb..c6e9f33c6 100644 --- a/pkg/storage/query.go +++ b/pkg/storage/query.go @@ -57,7 +57,7 @@ func convertSortKeys(values []string) bson.D { sortKey = strings.Trim(key, "-") sortOrder = -1 } - keys[i] = bson.E{sortKey, sortOrder} + keys[i] = bson.E{Key: sortKey, Value: sortOrder} } return keys } diff --git a/pkg/storage/query_test.go b/pkg/storage/query_test.go index 133b5e3f0..701b4468e 100644 --- a/pkg/storage/query_test.go +++ b/pkg/storage/query_test.go @@ -69,8 +69,8 @@ func TestFindOptions_ToPluginOptions(t *testing.T) { } po := so.ToPluginOptions("mythings") wantSortDoc := bson.D{ - {"_id", -1}, - {"name", 1}} + {Key: "_id", Value: -1}, + {Key: "name", Value: 1}} require.Equal(t, wantSortDoc, po.Sort) } diff --git a/pkg/storage/run.go b/pkg/storage/run.go index 299e81398..ca1751b11 100644 --- a/pkg/storage/run.go +++ b/pkg/storage/run.go @@ -16,36 +16,36 @@ type Run struct { SchemaVersion schema.Version `json:"schemaVersion" yaml:"schemaVersion" toml:"schemaVersion"` // ID of the Run. - ID string `json:"_id" yaml:"_id", toml:"_id"` + ID string `json:"_id" yaml:"_id" toml:"_id"` // Created timestamp of the Run. - Created time.Time `json:"created" yaml:"created", toml:"created"` + Created time.Time `json:"created" yaml:"created" toml:"created"` // Namespace of the installation. - Namespace string `json:"namespace" yaml:"namespace", toml:"namespace"` + Namespace string `json:"namespace" yaml:"namespace" toml:"namespace"` // Installation name. - Installation string `json:"installation" yaml:"installation", toml:"installation"` + Installation string `json:"installation" yaml:"installation" toml:"installation"` // Revision of the installation. - Revision string `json:"revision" yaml:"revision", toml:"revision"` + Revision string `json:"revision" yaml:"revision" toml:"revision"` // Action executed against the installation. - Action string `json:"action" yaml:"action", toml:"action"` + Action string `json:"action" yaml:"action" toml:"action"` // Bundle is the definition of the bundle. - Bundle bundle.Bundle `json:"bundle" yaml:"bundle", toml:"bundle"` + Bundle bundle.Bundle `json:"bundle" yaml:"bundle" toml:"bundle"` // BundleReference is the canonical reference to the bundle used in the action. - BundleReference string `json:"bundleReference" yaml:"bundleReference", toml:"bundleReference"` + BundleReference string `json:"bundleReference" yaml:"bundleReference" toml:"bundleReference"` // BundleDigest is the digest of the bundle. // TODO(carolynvs): populate this - BundleDigest string `json:"bundleDigest" yaml:"bundleDigest", toml:"bundleDigest"` + BundleDigest string `json:"bundleDigest" yaml:"bundleDigest" toml:"bundleDigest"` // ParameterOverrides are the key/value parameter overrides (taking precedence over // parameters specified in a parameter set) specified during the run. - ParameterOverrides ParameterSet `json:"parameterOverrides, omitempty" yaml:"parameterOverrides, omitempty", toml:"parameterOverrides, omitempty"` + ParameterOverrides ParameterSet `json:"parameterOverrides,omitempty" yaml:"parameterOverrides,omitempty" toml:"parameterOverrides,omitempty"` // CredentialSets is a list of the credential set names used during the run. CredentialSets []string `json:"credentialSets,omitempty" yaml:"credentialSets,omitempty" toml:"credentialSets,omitempty"` @@ -61,7 +61,7 @@ type Run struct { // Custom extension data applicable to a given runtime. // TODO(carolynvs): remove custom and populate it in ToCNAB - Custom interface{} `json:"custom" yaml:"custom", toml:"custom"` + Custom interface{} `json:"custom" yaml:"custom" toml:"custom"` } func (r Run) DefaultDocumentFilter() map[string]interface{} { @@ -118,7 +118,7 @@ func (r Run) ToCNAB() cnab.Claim { // TypedParameterValues returns parameters values that have been converted to // its typed value based on its bundle definition. func (r Run) TypedParameterValues() map[string]interface{} { - bun := cnab.ExtendedBundle{r.Bundle} + bun := cnab.NewBundle(r.Bundle) value := make(map[string]interface{}) for _, param := range r.Parameters.Parameters { From 22917e60a0e4b47199a4190f4900fc87c782a165 Mon Sep 17 00:00:00 2001 From: Kevin Barbour Date: Thu, 16 Jun 2022 19:58:59 +0200 Subject: [PATCH 08/23] Improve error message loading wrong schema (#2157) * Improve error message loading wrong schema Signed-off-by: Kevin Barbour * Add myself to CONTRIBUTORS.MD Signed-off-by: Kevin Barbour * Don't use errors pkg, fix assert in test Signed-off-by: Kevin Barbour Signed-off-by: joshuabezaleel --- CONTRIBUTORS.md | 3 +- pkg/manifest/manifest.go | 2 +- pkg/manifest/manifest_test.go | 13 ++++++ .../testdata/porter-with-badschema.yaml | 42 +++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 pkg/manifest/testdata/porter-with-badschema.yaml diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 850bd7081..fe2a82e47 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -69,4 +69,5 @@ and we will add you. **All** contributors belong here. 💯 * [Tamir Kamara](https://github.com/tamirkamara) * [Chioma Onyekpere](https://github.com/Simpcyclassy) * [Hrittik Roy](https://github.com/hrittikhere) -* [Tanmay Chaudhry](https://github.com/tchaudhry91) \ No newline at end of file +* [Tanmay Chaudhry](https://github.com/tchaudhry91) +* [Kevin Barbour](https://github.com/kevinbarbour) \ No newline at end of file diff --git a/pkg/manifest/manifest.go b/pkg/manifest/manifest.go index 732246041..41502a666 100644 --- a/pkg/manifest/manifest.go +++ b/pkg/manifest/manifest.go @@ -1007,7 +1007,7 @@ func ReadManifest(cxt *portercontext.Context, path string) (*Manifest, error) { m, err := UnmarshalManifest(cxt, data) if err != nil { - return nil, err + return nil, fmt.Errorf("unsupported property set or a custom action is defined incorrectly: %w", err) } m.ManifestPath = path diff --git a/pkg/manifest/manifest_test.go b/pkg/manifest/manifest_test.go index ac1bf65c1..3fd2dc0d7 100644 --- a/pkg/manifest/manifest_test.go +++ b/pkg/manifest/manifest_test.go @@ -221,6 +221,19 @@ func TestManifest_Validate_Dockerfile(t *testing.T) { assert.EqualError(t, err, "Dockerfile template cannot be named 'Dockerfile' because that is the filename generated during porter build") } +func TestManifest_Validate_WrongSchema(t *testing.T) { + c := config.NewTestConfig(t) + + c.TestContext.AddTestFile("testdata/porter-with-badschema.yaml", config.Name) + _, err := LoadManifestFrom(context.Background(), c.Config, config.Name) + + require.Error(t, err) + assert.Regexp(t, + "unsupported property set or a custom action is defined incorrectly: error unmarshaling custom action baddata", + err, + ) +} + func TestReadManifest_URL(t *testing.T) { cxt := portercontext.NewTestContext(t) url := "https://raw.githubusercontent.com/getporter/porter/v0.27.1/pkg/manifest/testdata/simple.porter.yaml" diff --git a/pkg/manifest/testdata/porter-with-badschema.yaml b/pkg/manifest/testdata/porter-with-badschema.yaml new file mode 100644 index 000000000..ea84a63ef --- /dev/null +++ b/pkg/manifest/testdata/porter-with-badschema.yaml @@ -0,0 +1,42 @@ +schemaVersion: 1.0.0-alpha.1 +name: hello +description: "An example Porter configuration" +version: v0.1.0 +registry: "localhost:5000" + +mixins: + - exec + +maintainers: +- name: "John Doe" + email: "john.doe@example.com" + url: "https://example.com/a" +- name: "Jane Doe" + url: "https://example.com/b" +- name: "Janine Doe" + email: "janine.doe@example.com" +- email: "mike.doe@example.com" + url: "https://example.com/c" + +install: +- exec: + description: "Say Hello" + command: bash + flags: + c: echo Hello World + +status: +- exec: + description: "Get World Status" + command: bash + flags: + c: echo The world is on fire + +uninstall: +- exec: + description: "Say Goodbye" + command: bash + flags: + c: echo Goodbye World + +baddata: true \ No newline at end of file From 3e2700d48a9eee6184e2b8ab04d911f28b7f83ca Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Thu, 16 Jun 2022 13:42:50 -0500 Subject: [PATCH 09/23] Add prow github action This adds a prow github action that allows specified people (in the OWNERS file) to comment on a pull request with /lgtm to review the pull request, or /approve to merge the pull request. The github action handles executing the commands for you so that you don't need to have maintainer rights on the repository. Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel --- .github/workflows/prow-commands.yaml | 19 +++++++++++++++++++ .github/workflows/prow-merge-pr.yaml | 17 +++++++++++++++++ OWNERS | 9 +++++++++ 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/prow-commands.yaml create mode 100644 .github/workflows/prow-merge-pr.yaml create mode 100644 OWNERS diff --git a/.github/workflows/prow-commands.yaml b/.github/workflows/prow-commands.yaml new file mode 100644 index 000000000..8036df09f --- /dev/null +++ b/.github/workflows/prow-commands.yaml @@ -0,0 +1,19 @@ +# https://github.com/jpmcb/prow-github-actions + +# This reacts to issue comments and checks for prow slash comments, and runs the command if found. +name: "React to Prow Commands" +on: [issue_comment] +permissions: + issues: write # give permission to apply the lgtm label + pull-requests: write # give permission to approve the PR + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@2ac4434b3ce3d523fc3e28a879ec671c4a7750fa # main + with: + prow-commands: | + /approve + /lgtm + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prow-merge-pr.yaml b/.github/workflows/prow-merge-pr.yaml new file mode 100644 index 000000000..589e4a6f1 --- /dev/null +++ b/.github/workflows/prow-merge-pr.yaml @@ -0,0 +1,17 @@ +# https://github.com/jpmcb/prow-github-actions + +# This will check all pull requests that have the lgtm label, and if GitHub thinks it is mergeable, then the PR is merged. +name: "Merge Ready PRs" +on: [pull_request_target] +permissions: + issues: write # give permission to apply the lgtm label + pull-requests: write # give permission to approve the PR + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@2ac4434b3ce3d523fc3e28a879ec671c4a7750fa # main + with: + jobs: "lgtm" + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/OWNERS b/OWNERS new file mode 100644 index 000000000..d4adcc633 --- /dev/null +++ b/OWNERS @@ -0,0 +1,9 @@ +# reviewers can comment with /lgtm, a label "lgtm" is put on the issue +reviewers: +- vinozzz + +# approvers can comment with /approve, the bot leaves an approve code review, allowing it to be merged +approvers: +- carolynvs + +# Once a PR has the lgtm label, and a "green" code review (from /approve), a cron job will notice the PR and merge it From 94a67e38fe6b971d740d1d7dad76cb0ea7ca3a28 Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Thu, 16 Jun 2022 13:54:04 -0500 Subject: [PATCH 10/23] Switch prow to use pull_request instead of _target Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel --- .github/workflows/prow-merge-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prow-merge-pr.yaml b/.github/workflows/prow-merge-pr.yaml index 589e4a6f1..168fec3b4 100644 --- a/.github/workflows/prow-merge-pr.yaml +++ b/.github/workflows/prow-merge-pr.yaml @@ -2,7 +2,7 @@ # This will check all pull requests that have the lgtm label, and if GitHub thinks it is mergeable, then the PR is merged. name: "Merge Ready PRs" -on: [pull_request_target] +on: [pull_request] permissions: issues: write # give permission to apply the lgtm label pull-requests: write # give permission to approve the PR From ca4fc28093a2cb205ec8c0819db06ed4a8c68234 Mon Sep 17 00:00:00 2001 From: Steven Gettys Date: Thu, 16 Jun 2022 11:52:02 -0700 Subject: [PATCH 11/23] Updated installation schema with correct dependency schema Signed-off-by: Steven Gettys Signed-off-by: joshuabezaleel --- pkg/porter/schema_test.go | 63 +++++++------ .../testdata/porter-with-dependencies.yaml | 90 +++++++++++++++++++ pkg/porter/testdata/schema.json | 25 +++++- pkg/schema/manifest.schema.json | 23 ++++- 4 files changed, 166 insertions(+), 35 deletions(-) create mode 100644 pkg/porter/testdata/porter-with-dependencies.yaml diff --git a/pkg/porter/schema_test.go b/pkg/porter/schema_test.go index 1e1ec75a8..fb1c359a2 100644 --- a/pkg/porter/schema_test.go +++ b/pkg/porter/schema_test.go @@ -2,6 +2,7 @@ package porter import ( "context" + "fmt" "io/ioutil" "testing" @@ -23,33 +24,39 @@ func TestPorter_PrintManifestSchema(t *testing.T) { } func TestPorter_ValidateManifestSchema(t *testing.T) { - ctx := context.Background() - p := NewTestPorter(t) - defer p.Close() - - // Load the default Porter manifest - b, err := ioutil.ReadFile("testdata/porter.yaml") - require.NoError(t, err) - - // Load the manifest as a go dump - m := make(map[string]interface{}) - err = yaml.Unmarshal(b, &m) - require.NoError(t, err) - manifestLoader := gojsonschema.NewGoLoader(m) - - // Load the manifest schema - err = p.PrintManifestSchema(ctx) - require.NoError(t, err, "could not generate schema") - schema := p.TestConfig.TestContext.GetOutput() - schemaLoader := gojsonschema.NewStringLoader(schema) - - // Validate the manifest against the schema - fails, err := gojsonschema.Validate(schemaLoader, manifestLoader) - require.NoError(t, err) - - assert.Empty(t, fails.Errors(), "expected testdata/porter.yaml to validate against the porter schema") - // Print it pretty like - for _, err := range fails.Errors() { - t.Logf("%s", err) + manifests := []string{"testdata/porter.yaml", "testdata/porter-with-dependencies.yaml"} + for _, m := range manifests { + t.Run(fmt.Sprintf("Manifest %s", m), func(t *testing.T) { + + ctx := context.Background() + p := NewTestPorter(t) + defer p.Close() + + // Load the default Porter manifest + b, err := ioutil.ReadFile(m) + require.NoError(t, err) + + // Load the manifest as a go dump + m := make(map[string]interface{}) + err = yaml.Unmarshal(b, &m) + require.NoError(t, err) + manifestLoader := gojsonschema.NewGoLoader(m) + + // Load the manifest schema + err = p.PrintManifestSchema(ctx) + require.NoError(t, err, "could not generate schema") + schema := p.TestConfig.TestContext.GetOutput() + schemaLoader := gojsonschema.NewStringLoader(schema) + + // Validate the manifest against the schema + fails, err := gojsonschema.Validate(schemaLoader, manifestLoader) + require.NoError(t, err) + + assert.Empty(t, fails.Errors(), "expected testdata/porter.yaml to validate against the porter schema") + // Print it pretty like + for _, err := range fails.Errors() { + t.Logf("%s", err) + } + }) } } diff --git a/pkg/porter/testdata/porter-with-dependencies.yaml b/pkg/porter/testdata/porter-with-dependencies.yaml new file mode 100644 index 000000000..65f27cae0 --- /dev/null +++ b/pkg/porter/testdata/porter-with-dependencies.yaml @@ -0,0 +1,90 @@ +schemaVersion: 1.0.0-alpha.1 +name: porter-hello +version: 0.1.0 +description: "A bundle with a custom action" +registry: "localhost:5000" + +custom: + customKey1: "customValue1" + +credentials: + - name: my-first-cred + env: MY_FIRST_CRED + - name: my-second-cred + description: "My second cred" + path: /path/to/my-second-cred + +images: + something: + description: "an image" + imageType: "docker" + repository: "getporter/boo" + +dependencies: + requires: + - name: some-dep + bundle: + reference: some-repo + version: ">1.0" + parameters: + param1: first-param + +parameters: + - name: my-first-param + type: integer + default: 9 + env: MY_FIRST_PARAM + applyTo: + - "install" + - name: my-second-param + description: "My second parameter" + type: string + default: spring-music-demo + path: /path/to/my-second-param + sensitive: true + +outputs: + - name: my-first-output + type: string + applyTo: + - "install" + - "upgrade" + sensitive: true + - name: my-second-output + description: "My second output" + type: boolean + sensitive: false + - name: kubeconfig + type: file + path: /home/nonroot/.kube/config + +mixins: + - exec + +install: + - exec: + description: "Install Hello World with custom arguments" + command: echo + arguments: + - "{{ bundle.custom.customKey1 }}" + +upgrade: + - exec: + description: "World 2.0" + command: bash + flags: + c: echo World 2.0 + +zombies: + - exec: + description: "Trigger zombie apocalypse" + command: bash + flags: + c: echo oh noes my brains + +uninstall: + - exec: + description: "Uninstall Hello World" + command: bash + flags: + c: echo Goodbye World diff --git a/pkg/porter/testdata/schema.json b/pkg/porter/testdata/schema.json index e583144a4..731aad718 100644 --- a/pkg/porter/testdata/schema.json +++ b/pkg/porter/testdata/schema.json @@ -19,6 +19,23 @@ }, "type": "array" }, + "bundle": { + "description": "The defintion of a bundle reference", + "properties": { + "reference": { + "description": "The full bundle reference for the dependency in the format REGISTRY/NAME:TAG", + "type": "string" + }, + "version": { + "description": "Bundle version contstraint for version matching, see https://github.com/Masterminds/semver/blob/master/README.md#checking-version-constraints", + "type": "string" + } + }, + "required": [ + "reference" + ], + "type": "object" + }, "credential": { "description": "Credential defines a particular credential, and where it should be placed in the invocation image", "properties": { @@ -72,19 +89,19 @@ "dependency": { "additionalProperties": false, "properties": { + "bundle": { + "$ref": "#/definitions/bundle" + }, "name": { "type": "string" }, "parameters": { "type": "object" - }, - "reference": { - "type": "string" } }, "required": [ "name", - "reference" + "bundle" ], "type": "object" }, diff --git a/pkg/schema/manifest.schema.json b/pkg/schema/manifest.schema.json index c1c8cc9ea..ec680536e 100644 --- a/pkg/schema/manifest.schema.json +++ b/pkg/schema/manifest.schema.json @@ -170,8 +170,8 @@ "name": { "type": "string" }, - "reference": { - "type": "string" + "bundle": { + "$ref": "#/definitions/bundle" }, "parameters": { "type": "object" @@ -179,6 +179,23 @@ }, "required": [ "name", + "bundle" + ], + "type": "object" + }, + "bundle": { + "description": "The defintion of a bundle reference", + "properties": { + "reference": { + "description": "The full bundle reference for the dependency in the format REGISTRY/NAME:TAG", + "type": "string" + }, + "version": { + "description": "Bundle version contstraint for version matching, see https://github.com/Masterminds/semver/blob/master/README.md#checking-version-constraints", + "type": "string" + } + }, + "required": [ "reference" ], "type": "object" @@ -436,4 +453,4 @@ "upgrade", "uninstall" ] -} +} \ No newline at end of file From 6338fc7faddcd6c80c17abd855866141ab830a66 Mon Sep 17 00:00:00 2001 From: Steven Gettys Date: Thu, 16 Jun 2022 11:56:54 -0700 Subject: [PATCH 12/23] changed new manifest description for test Signed-off-by: Steven Gettys Signed-off-by: joshuabezaleel --- pkg/porter/testdata/porter-with-dependencies.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/porter/testdata/porter-with-dependencies.yaml b/pkg/porter/testdata/porter-with-dependencies.yaml index 65f27cae0..316f61e0e 100644 --- a/pkg/porter/testdata/porter-with-dependencies.yaml +++ b/pkg/porter/testdata/porter-with-dependencies.yaml @@ -1,7 +1,7 @@ schemaVersion: 1.0.0-alpha.1 name: porter-hello version: 0.1.0 -description: "A bundle with a custom action" +description: "A bundle with dependencies" registry: "localhost:5000" custom: From 52bf2731cf62f481ff65a8e69ed5066f0908fc2c Mon Sep 17 00:00:00 2001 From: Carolyn Van Slyck Date: Thu, 9 Jun 2022 14:13:53 -0500 Subject: [PATCH 13/23] Update k8s and containerd dependencies * Update to cnab-go v0.23.4 * Update containerd to v1.6.6 * Updated k8s to v0.24.1. This does not update docker since buildkit uses a funny unreleased version of docker. We won't be able to update to a new version of Docker until there's a release that has the new feature that buildkit relies upon. See go.mod for a link to the troublesome package in question. Signed-off-by: Carolyn Van Slyck Signed-off-by: joshuabezaleel --- go.mod | 49 ++++++++++++++++++++++--------------- go.sum | 77 ++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 80 insertions(+), 46 deletions(-) diff --git a/go.mod b/go.mod index c7acb0ef2..26afb560c 100644 --- a/go.mod +++ b/go.mod @@ -25,14 +25,14 @@ require ( github.com/carolynvs/datetime-printer v0.2.0 github.com/carolynvs/magex v0.8.0 github.com/cbroglie/mustache v1.0.1 - github.com/cnabio/cnab-go v0.23.3 + github.com/cnabio/cnab-go v0.23.4 github.com/cnabio/cnab-to-oci v0.3.3 - github.com/containerd/containerd v1.6.1 + github.com/containerd/containerd v1.6.6 github.com/davecgh/go-spew v1.1.1 github.com/docker/buildx v0.8.1 - github.com/docker/cli v20.10.13+incompatible + github.com/docker/cli v20.10.17+incompatible github.com/docker/distribution v2.8.1+incompatible - github.com/docker/docker v20.10.13+incompatible + github.com/docker/docker v20.10.17+incompatible github.com/dustin/go-humanize v1.0.0 github.com/ghodss/yaml v1.0.0 github.com/google/go-cmp v0.5.7 @@ -91,6 +91,8 @@ require ( github.com/Microsoft/go-winio v0.5.2 // indirect github.com/PaesslerAG/gval v1.0.0 // indirect github.com/PuerkitoBio/goquery v1.5.0 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect github.com/andybalholm/brotli v1.0.0 // indirect github.com/andybalholm/cascadia v1.0.0 // indirect @@ -103,13 +105,14 @@ require ( github.com/containerd/ttrpc v1.1.0 // indirect github.com/containerd/typeurl v1.0.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/cyberphone/json-canonicalization v0.0.0-20210303052042-6bc126869bf4 // indirect + github.com/cyberphone/json-canonicalization v0.0.0-20220216171627-b6721b06b4ef // indirect github.com/docker/docker-credential-helpers v0.6.4 // indirect github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-units v0.4.0 // indirect github.com/dsnet/compress v0.0.1 // indirect + github.com/emicklei/go-restful v2.9.5+incompatible // indirect github.com/fatih/color v1.9.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect @@ -117,6 +120,9 @@ require ( github.com/fvbommel/sortorder v1.0.2 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.5 // indirect + github.com/go-openapi/swag v0.19.14 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-yaml v1.8.1 // indirect github.com/gofrs/flock v0.7.3 // indirect @@ -124,9 +130,9 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4-0.20210608040537-544b4180ac70 // indirect + github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect - github.com/googleapis/gnostic v0.5.5 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -136,16 +142,18 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jeremywohl/flatten v1.0.1 // indirect github.com/jinzhu/inflection v1.0.0 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.15.1 // indirect github.com/klauspost/pgzip v1.2.4 // indirect github.com/magiconair/properties v1.8.1 // indirect + github.com/mailru/easyjson v0.7.6 // indirect github.com/mattn/go-runewidth v0.0.9 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mholt/archiver/v3 v3.5.0 // indirect - github.com/miekg/pkcs11 v1.0.3 // indirect + github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/reflectwalk v1.0.0 // indirect @@ -158,11 +166,12 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/nwaples/rardecode v1.1.0 // indirect github.com/oklog/run v1.0.0 // indirect github.com/oklog/ulid v1.3.1 // indirect - github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.0 // indirect + github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect + github.com/opencontainers/runc v1.1.2 // indirect github.com/osteele/tuesday v1.0.3 // indirect github.com/pierrec/lz4/v4 v4.0.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -202,26 +211,26 @@ require ( go.opentelemetry.io/proto/otlp v0.12.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect + golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect - golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect - golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 // indirect + golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect + golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect + golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.56.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/api v0.23.4 // indirect - k8s.io/apimachinery v0.23.4 // indirect - k8s.io/client-go v0.23.4 // indirect - k8s.io/klog/v2 v2.30.0 // indirect - k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect - k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect - sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect + k8s.io/api v0.24.1 // indirect + k8s.io/apimachinery v0.24.1 // indirect + k8s.io/client-go v0.24.1 // indirect + k8s.io/klog/v2 v2.60.1 // indirect + k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect + k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect + sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) diff --git a/go.sum b/go.sum index 3103dce3b..1c91ee8f3 100644 --- a/go.sum +++ b/go.sum @@ -157,8 +157,8 @@ github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+V github.com/Microsoft/hcsshim v0.8.20/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwTOcER2fw4I4= github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= -github.com/Microsoft/hcsshim v0.9.2 h1:wB06W5aYFfUB3IvootYAY2WnOmIdgPGfqSI6tufQNnY= github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc= +github.com/Microsoft/hcsshim v0.9.3 h1:k371PzBuRrz2b+ebGuI2nVgVhgsVX60jMfSw80NECxo= github.com/Microsoft/hcsshim/test v0.0.0-20200826032352-301c83a30e7c/go.mod h1:30A5igQ91GEmhYJF8TaRP79pMBOYynRsyOByfVV0dU4= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= @@ -176,8 +176,10 @@ github.com/PaesslerAG/jsonpath v0.1.1/go.mod h1:lVboNxFGal/VwW6d9JzIy56bUsYAP6tH github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk= github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d h1:UrqY+r/OJnIp5u0s1SbQ8dVfLCZJsnvazdBP5hS4iRs= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= @@ -220,6 +222,7 @@ github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= @@ -312,8 +315,8 @@ github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4 github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cfssl v0.0.0-20181213083726-b94e044bb51e/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= github.com/cloudflare/cfssl v1.4.1 h1:vScfU2DrIUI9VPHBVeeAQ0q5A+9yshO1Gz+3QoUQiKw= -github.com/cnabio/cnab-go v0.23.3 h1:ehpE5PGe+g+Mybf3xz1trraMcVY+RkZdMRvpcWgXq2E= -github.com/cnabio/cnab-go v0.23.3/go.mod h1:cuExj5X7qJp7maA6Yl/NcKbfVaqzsRlqzOg4dM+OmnY= +github.com/cnabio/cnab-go v0.23.4 h1:jplQcSnvFyQlD6swiqL3BmqRnhbnS+lc/EKdBLH9E80= +github.com/cnabio/cnab-go v0.23.4/go.mod h1:9EmgHR51LFqQStzaC+xHPJlkD4OPsF6Ev5Y8e/YHEns= github.com/cnabio/cnab-to-oci v0.3.3 h1:92sJJoOGWp4Dg9AErXPMHTFI6qYZuPMdL1PXU1WVyB4= github.com/cnabio/cnab-to-oci v0.3.3/go.mod h1:tp1FxK29rjLAP2v7tqzVmNI20B+2lCvEC7H3yUdIKD4= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= @@ -375,8 +378,9 @@ github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoT github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c= github.com/containerd/containerd v1.5.8/go.mod h1:YdFSv5bTFLpG2HIYmfqDpSYYTDX+mc5qtSuYx1YUb/s= -github.com/containerd/containerd v1.6.1 h1:oa2uY0/0G+JX4X7hpGCYvkp9FjUancz56kSNnb1sG3o= github.com/containerd/containerd v1.6.1/go.mod h1:1nJz5xCZPusx6jJU8Frfct988y0NpumIq9ODB0kLtoE= +github.com/containerd/containerd v1.6.6 h1:xJNPhbrmz8xAMDNoVjHy9YHtWwEQNS+CDkcIRh7t8Y0= +github.com/containerd/containerd v1.6.6/go.mod h1:ZoP1geJldzCVY3Tonoz7b1IXk8rIX0Nltt5QE4OMNk0= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -471,8 +475,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberphone/json-canonicalization v0.0.0-20210303052042-6bc126869bf4 h1:7AjYfmq7AmviXsuZjV5DcE7PuhJ4dWMi8gLllpLVDQY= -github.com/cyberphone/json-canonicalization v0.0.0-20210303052042-6bc126869bf4/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw= +github.com/cyberphone/json-canonicalization v0.0.0-20220216171627-b6721b06b4ef h1:blzyKcspSvTxyRUVnpaY69EOIn7OKXmC7Pi5cMleqDQ= +github.com/cyberphone/json-canonicalization v0.0.0-20220216171627-b6721b06b4ef/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1SMSibvLzxjeJLnrYEVLULFNiHY9YfQ= @@ -544,6 +548,7 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg github.com/elazarl/goproxy v0.0.0-20191011121108-aa519ddbe484/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/elazarl/goproxy/ext v0.0.0-20190711103511-473e67f1d7d2/go.mod h1:gNh8nYJoAm43RfaxurUnxr+N1PwuFV3ZMl/efxlIlY8= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao2r4iyvLdACqsl/Ljk= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -622,16 +627,19 @@ github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dT github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= @@ -779,6 +787,8 @@ github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9 github.com/google/certificate-transparency-go v1.0.21 h1:Yf1aXowfZ2nuboBsg7iYGLmwsOARdV86pfH3g95wXmE= github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= github.com/google/crfs v0.0.0-20191108021818-71d77da419c9/go.mod h1:etGhoOqfwPkooV6aqoX3eBGQOJblqdoc9XvWOeuxpPw= +github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -846,7 +856,6 @@ github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsC github.com/googleapis/gnostic v0.2.2/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= -github.com/googleapis/gnostic v0.5.5 h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw= github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8= @@ -975,6 +984,7 @@ github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52Cu github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -1052,6 +1062,7 @@ github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= @@ -1097,8 +1108,9 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex github.com/mholt/archiver/v3 v3.5.0 h1:nE8gZIrw66cu4osS/U7UW7YDuGMHssxKutU8IfWxwWE= github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/miekg/pkcs11 v1.0.3 h1:iMwmD7I5225wv84WxIG/bmxz9AXjWvTWIbM/TYHvWtw= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= +github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mikefarah/yq/v3 v3.0.0-20201020025845-ccb718cd0f59 h1:6nvF+EEFIVD4KT64CgvAzWaMVC283Huno59khWs9r1A= github.com/mikefarah/yq/v3 v3.0.0-20201020025845-ccb718cd0f59/go.mod h1:7eVjFf5bgozMuHk+oKpyxR2zCN3iEN1tF0/bM5jvtKo= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= @@ -1172,6 +1184,7 @@ github.com/mreiferson/go-httpclient v0.0.0-20160630210159-31f0106b4474/go.mod h1 github.com/mrunalp/fileutils v0.0.0-20200520151820-abd8a0e76976/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -1224,8 +1237,8 @@ github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoT github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc= -github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -1236,8 +1249,8 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2-0.20211117181255-693428a734f5/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= -github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= +github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -1246,8 +1259,9 @@ github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rm github.com/opencontainers/runc v1.0.0-rc92/go.mod h1:X1zlU4p7wOlX4+WRCz+hvlRv8phdL7UqbYD+vQwNMmE= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runc v1.1.0 h1:O9+X96OcDjkmmZyfaG996kV7yq8HsoU2h1XRRQcefG8= github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= +github.com/opencontainers/runc v1.1.2 h1:2VSZwLx5k/BfsBxMMipG/LYUnmqOD/BPkIVgQUcTlLw= +github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= @@ -1260,8 +1274,8 @@ github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mo github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= -github.com/opencontainers/selinux v1.10.0 h1:rAiKF8hTcgLI3w0DHm6i0ylVVcOrlgR1kK99DRLDhyU= github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= +github.com/opencontainers/selinux v1.10.1 h1:09LIPVRP3uuZGQvgR+SgMSNBd1Eb3vlRbGqQpoHsF8w= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing-contrib/go-stdlib v1.0.0/go.mod h1:qtI1ogk+2JhVPIXVc6q+NHziSmy2W5GbdQZFUHADCBU= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= @@ -1716,8 +1730,9 @@ golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8= golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1824,6 +1839,7 @@ golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180724155351-3d292e4d0cdc/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1843,8 +1859,9 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1979,8 +1996,9 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2005,8 +2023,9 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -2340,8 +2359,9 @@ k8s.io/api v0.20.1/go.mod h1:KqwcCVogGxQY3nBlRpwt+wpAMF/KjaCc7RpywacvqUo= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/api v0.20.6/go.mod h1:X9e8Qag6JV/bL5G6bU8sdVRltWKmdHsFUGS3eVndqE8= k8s.io/api v0.22.5/go.mod h1:mEhXyLaSD1qTOf40rRiKXkc+2iCem09rWLlFwhCEiAs= -k8s.io/api v0.23.4 h1:85gnfXQOWbJa1SiWGpE9EEtHs0UVvDyIsSMpEtl2D4E= k8s.io/api v0.23.4/go.mod h1:i77F4JfyNNrhOjZF7OwwNJS5Y1S9dpwvb9iYRYRczfI= +k8s.io/api v0.24.1 h1:BjCMRDcyEYz03joa3K1+rbshwh1Ay6oB53+iUx2H8UY= +k8s.io/api v0.24.1/go.mod h1:JhoOvNiLXKTPQ60zh2g0ewpA+bnEYf5q44Flhquh4vQ= k8s.io/apimachinery v0.0.0-20180904193909-def12e63c512/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apimachinery v0.0.0-20190806215851-162a2dabc72f/go.mod h1:+ntn62igV2hyNj7/0brOvXSMONE2KxcePkSxK7/9FFQ= k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g= @@ -2351,8 +2371,9 @@ k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRp k8s.io/apimachinery v0.20.6/go.mod h1:ejZXtW1Ra6V1O5H8xPBGz+T3+4gfkTCeExAHKU57MAc= k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= k8s.io/apimachinery v0.22.5/go.mod h1:xziclGKwuuJ2RM5/rSFQSYAj0zdbci3DH8kj+WvyN0U= -k8s.io/apimachinery v0.23.4 h1:fhnuMd/xUL3Cjfl64j5ULKZ1/J9n8NuQEgNL+WXWfdM= k8s.io/apimachinery v0.23.4/go.mod h1:BEuFMMBaIbcOqVIJqNZJXGFTP4W6AycEpb5+m/97hrM= +k8s.io/apimachinery v0.24.1 h1:ShD4aDxTQKN5zNf8K1RQ2u98ELLdIW7jEnlO9uAMX/I= +k8s.io/apimachinery v0.24.1/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM= k8s.io/apiserver v0.17.4/go.mod h1:5ZDQ6Xr5MNBxyi3iUZXS84QOhZl+W7Oq2us/29c0j9I= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/apiserver v0.20.4/go.mod h1:Mc80thBKOyy7tbvFtB4kJv1kbdD0eIH8k8vianJcbFM= @@ -2365,8 +2386,9 @@ k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= k8s.io/client-go v0.20.4/go.mod h1:LiMv25ND1gLUdBeYxBIwKpkSC5IsozMMmOOeSJboP+k= k8s.io/client-go v0.20.6/go.mod h1:nNQMnOvEUEsOzRRFIIkdmYOjAZrC8bgq0ExboWSU1I0= k8s.io/client-go v0.22.5/go.mod h1:cs6yf/61q2T1SdQL5Rdcjg9J1ElXSwbjSrW2vFImM4Y= -k8s.io/client-go v0.23.4 h1:YVWvPeerA2gpUudLelvsolzH7c2sFoXXR5wM/sWqNFU= k8s.io/client-go v0.23.4/go.mod h1:PKnIL4pqLuvYUK1WU7RLTMYKPiIh7MYShLshtRY9cj0= +k8s.io/client-go v0.24.1 h1:w1hNdI9PFrzu3OlovVeTnf4oHDt+FJLd9Ndluvnb42E= +k8s.io/client-go v0.24.1/go.mod h1:f1kIDqcEYmwXS/vTbbhopMUbhKp2JhOeVTfxgaCIlF8= k8s.io/cloud-provider v0.17.4/go.mod h1:XEjKDzfD+b9MTLXQFlDGkk6Ho8SGMpaU8Uugx/KNK9U= k8s.io/code-generator v0.17.2/go.mod h1:DVmfPQgxQENqDIzVR2ddLXMH34qeszkKSdH/N+s+38s= k8s.io/code-generator v0.19.7/go.mod h1:lwEq3YnLYb/7uVXLorOJfxg+cUu2oihFhHZ0n9NIla0= @@ -2396,8 +2418,9 @@ k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= -k8s.io/klog/v2 v2.30.0 h1:bUO6drIvCIsvZ/XFgfxoGFQU/a4Qkh0iAlvUR7vlHJw= k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc= +k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20180731170545-e3762e86a74c/go.mod h1:BXM9ceUBTj2QnfH2MK1odQs778ajze1RxcmP6S8RVVc= k8s.io/kube-openapi v0.0.0-20190709113604-33be087ad058/go.mod h1:nfDlWeOsu3pUf4yWGL+ERqohP4YsZcBJXWMK+gkzOA4= k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E= @@ -2405,10 +2428,10 @@ k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod h1:UuqjUnNftUyPE5H k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= k8s.io/kube-openapi v0.0.0-20211109043538-20434351676c/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= -k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 h1:E3J9oCLlaobFUqsjG9DfKbP2BmgwBL2p7pn0A3dG9W4= k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 h1:Gii5eqf+GmIEwGNKQYQClCayuJCe2/4fZUvF7VG99sU= +k8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk= k8s.io/kubernetes v1.11.10/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= -k8s.io/kubernetes v1.13.0 h1:qTfB+u5M92k2fCCCVP2iuhgwwSOv1EkAkvQY1tQODD8= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/legacy-cloud-providers v0.17.4/go.mod h1:FikRNoD64ECjkxO36gkDgJeiQWwyZTuBkhu+yxOc1Js= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= @@ -2417,8 +2440,9 @@ k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -k8s.io/utils v0.0.0-20211116205334-6203023598ed h1:ck1fRPWPJWsMd8ZRFsWc6mh/zHp5fZ/shhbrgPUxDAE= k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc= +k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= @@ -2435,8 +2459,9 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= -sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6/go.mod h1:p4QtZmO4uMYipTQNzagwnNoseA6OxSUutVw05NhYDRs= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y= +sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI= sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06/go.mod h1:/ULNhyfzRopfcjskuui0cTITekDduZ7ycKN3oUT9R18= sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= From e96235a7cfd90940d9b259c6cc0ef4d8a92b4f85 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Sat, 18 Jun 2022 21:44:59 +0700 Subject: [PATCH 14/23] Add comments Signed-off-by: joshuabezaleel --- pkg/porter/list.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/porter/list.go b/pkg/porter/list.go index 1476c52ab..25d9cbd15 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -113,7 +113,11 @@ type DisplayInstallation struct { Status storage.InstallationStatus `json:"status,omitempty" yaml:"status,omitempty" toml:"status,omitempty"` DisplayInstallationMetadata `json:"_calculated" yaml:"_calculated"` - DisplayInstallationState string `json:"displayInstallationState,omitempty" yaml:"displayInstallationState,omitempty" toml:"displayInstallationState,omitempty"` + // DisplayInstallationState is the latest state of the installation. + // It is either "installed", "uninstalled", or "defined". + DisplayInstallationState string `json:"displayInstallationState,omitempty" yaml:"displayInstallationState,omitempty" toml:"displayInstallationState,omitempty"` + // DisplayInstallationStatus is the latest status of the installation. + // It is either "succeeded, "failed", "installing", "uninstalling", "upgrading", or "running " DisplayInstallationStatus string `json:"displayInstallationStatus,omitempty" yaml:"displayInstallationStatus,omitempty" toml:"displayInstallationStatus,omitempty"` } From 4062b1a6e21c518387cab6584ef3b0041d4d2f80 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 13:18:28 +0700 Subject: [PATCH 15/23] StateDefined as default value Signed-off-by: joshuabezaleel --- pkg/porter/list.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/porter/list.go b/pkg/porter/list.go index 25d9cbd15..ba292d0ed 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -295,17 +295,13 @@ func (p *Porter) PrintInstallations(ctx context.Context, opts ListOptions) error } func setDisplayInstallationState(installation storage.Installation) string { - var state string - if installation.IsInstalled() { - state = StateInstalled + return StateInstalled } else if installation.IsUninstalled() { - state = StateUninstalled - } else if installation.IsDefined() { - state = StateDefined + return StateUninstalled } - return state + return StateDefined } func setDisplayInstallationStatus(installation storage.Installation) string { From ba643f3a2860683bcbbe0f70c6b609f764e6ca09 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 13:37:18 +0700 Subject: [PATCH 16/23] Move displayinstallation's state and status to metadata Signed-off-by: joshuabezaleel --- pkg/porter/list.go | 38 ++++++++++--------- pkg/porter/testdata/show/expected-output.json | 8 ++-- pkg/porter/testdata/show/expected-output.yaml | 4 +- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/pkg/porter/list.go b/pkg/porter/list.go index ba292d0ed..68905e481 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -112,6 +112,10 @@ type DisplayInstallation struct { // Status of the installation. Status storage.InstallationStatus `json:"status,omitempty" yaml:"status,omitempty" toml:"status,omitempty"` DisplayInstallationMetadata `json:"_calculated" yaml:"_calculated"` +} + +type DisplayInstallationMetadata struct { + ResolvedParameters DisplayValues `json:"resolvedParameters" yaml:"resolvedParameters"` // DisplayInstallationState is the latest state of the installation. // It is either "installed", "uninstalled", or "defined". @@ -121,27 +125,25 @@ type DisplayInstallation struct { DisplayInstallationStatus string `json:"displayInstallationStatus,omitempty" yaml:"displayInstallationStatus,omitempty" toml:"displayInstallationStatus,omitempty"` } -type DisplayInstallationMetadata struct { - ResolvedParameters DisplayValues `json:"resolvedParameters" yaml:"resolvedParameters"` -} - func NewDisplayInstallation(installation storage.Installation) DisplayInstallation { di := DisplayInstallation{ - SchemaType: "Installation", - SchemaVersion: installation.SchemaVersion, - ID: installation.ID, - Name: installation.Name, - Namespace: installation.Namespace, - Uninstalled: installation.Uninstalled, - Bundle: installation.Bundle, - Custom: installation.Custom, - Labels: installation.Labels, - CredentialSets: installation.CredentialSets, - ParameterSets: installation.ParameterSets, - Status: installation.Status, - DisplayInstallationState: setDisplayInstallationState(installation), - DisplayInstallationStatus: setDisplayInstallationStatus(installation), + SchemaType: "Installation", + SchemaVersion: installation.SchemaVersion, + ID: installation.ID, + Name: installation.Name, + Namespace: installation.Namespace, + Uninstalled: installation.Uninstalled, + Bundle: installation.Bundle, + Custom: installation.Custom, + Labels: installation.Labels, + CredentialSets: installation.CredentialSets, + ParameterSets: installation.ParameterSets, + Status: installation.Status, + DisplayInstallationMetadata: DisplayInstallationMetadata{ + DisplayInstallationState: setDisplayInstallationState(installation), + DisplayInstallationStatus: setDisplayInstallationStatus(installation), + }, } return di diff --git a/pkg/porter/testdata/show/expected-output.json b/pkg/porter/testdata/show/expected-output.json index 8d1ea4d74..d201ecb75 100644 --- a/pkg/porter/testdata/show/expected-output.json +++ b/pkg/porter/testdata/show/expected-output.json @@ -52,8 +52,8 @@ "sensitive": false, "value": "top-secret" } - ] - }, - "displayInstallationState": "installed", - "displayInstallationStatus": "succeeded" + ], + "displayInstallationState": "installed", + "displayInstallationStatus": "succeeded" + } } diff --git a/pkg/porter/testdata/show/expected-output.yaml b/pkg/porter/testdata/show/expected-output.yaml index 5d0bc8604..e1f9983cc 100644 --- a/pkg/porter/testdata/show/expected-output.yaml +++ b/pkg/porter/testdata/show/expected-output.yaml @@ -40,5 +40,5 @@ _calculated: type: unknown sensitive: false value: top-secret -displayInstallationState: installed -displayInstallationStatus: succeeded + displayInstallationState: installed + displayInstallationStatus: succeeded From d58cab0fe8845537e33cf7b447d6d453ea9b741f Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 14:47:54 +0700 Subject: [PATCH 17/23] Add golden file test for print installation Signed-off-by: joshuabezaleel --- pkg/porter/list_test.go | 42 +++++++++++++++++++ pkg/porter/testdata/list/expected-output.json | 28 +++++++++++++ pkg/porter/testdata/list/expected-output.txt | 4 ++ pkg/porter/testdata/list/expected-output.yaml | 22 ++++++++++ .../list/no-reference-expected-output.txt | 4 ++ pkg/porter/testdata/schema.json | 25 ++--------- 6 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 pkg/porter/testdata/list/expected-output.json create mode 100644 pkg/porter/testdata/list/expected-output.txt create mode 100644 pkg/porter/testdata/list/expected-output.yaml create mode 100644 pkg/porter/testdata/list/no-reference-expected-output.txt diff --git a/pkg/porter/list_test.go b/pkg/porter/list_test.go index 63403d187..fcb88a233 100644 --- a/pkg/porter/list_test.go +++ b/pkg/porter/list_test.go @@ -5,6 +5,7 @@ import ( "testing" "get.porter.sh/porter/pkg/cnab" + "get.porter.sh/porter/pkg/printer" "get.porter.sh/porter/pkg/secrets" "get.porter.sh/porter/pkg/storage" "github.com/stretchr/testify/assert" @@ -159,3 +160,44 @@ func TestDisplayInstallation_ConvertToInstallation(t *testing.T) { require.Equal(t, cnab.StatusRunning, convertedInstallation.Status.ResultStatus, "invalid last status") } + +func TestPorter_PrintInstallations(t *testing.T) { + t.Parallel() + + testcases := []struct { + name string + format printer.Format + outputFile string + }{ + {name: "plain", format: printer.FormatPlaintext, outputFile: "testdata/list/expected-output.txt"}, + {name: "no reference, plain", format: printer.FormatPlaintext, outputFile: "testdata/list/no-reference-expected-output.txt"}, + {name: "json", format: printer.FormatJson, outputFile: "testdata/list/expected-output.json"}, + {name: "yaml", format: printer.FormatYaml, outputFile: "testdata/list/expected-output.yaml"}, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + p := NewTestPorter(t) + defer p.Close() + + opts := ListOptions{ + Namespace: "dev", + Name: "mywordpress", + PrintOptions: printer.PrintOptions{ + Format: tc.format, + }, + } + + p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues, func(i *storage.Installation) { + i.Status.BundleVersion = "v1.2.3" + i.Status.ResultStatus = cnab.StatusSucceeded + }) + + ctx := context.Background() + + err := p.PrintInstallations(ctx, opts) + require.NoError(t, err, "PrintInstallation failed") + p.CompareGoldenFile(tc.outputFile, p.TestConfig.TestContext.GetOutput()) + }) + } +} diff --git a/pkg/porter/testdata/list/expected-output.json b/pkg/porter/testdata/list/expected-output.json new file mode 100644 index 000000000..683117465 --- /dev/null +++ b/pkg/porter/testdata/list/expected-output.json @@ -0,0 +1,28 @@ +[ + { + "schemaType": "Installation", + "schemaVersion": "1.0.1", + "id": "01FZVC5AVP8Z7A78CSCP1EJ604", + "name": "mywordpress", + "namespace": "dev", + "bundle": {}, + "status": { + "runId": "", + "action": "", + "resultId": "", + "resultStatus": "succeeded", + "created": "2020-04-18T01:02:03.000000004Z", + "modified": "2020-04-18T01:02:03.000000004Z", + "installed": null, + "uninstalled": null, + "bundleReference": "", + "bundleVersion": "v1.2.3", + "bundleDigest": "" + }, + "_calculated": { + "resolvedParameters": null, + "displayInstallationState": "defined", + "displayInstallationStatus": "succeeded" + } + } +] diff --git a/pkg/porter/testdata/list/expected-output.txt b/pkg/porter/testdata/list/expected-output.txt new file mode 100644 index 000000000..2fd40a2bc --- /dev/null +++ b/pkg/porter/testdata/list/expected-output.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------- + NAMESPACE NAME VERSION STATE STATUS MODIFIED +------------------------------------------------------------------- + dev mywordpress v1.2.3 defined succeeded 2020-04-18 diff --git a/pkg/porter/testdata/list/expected-output.yaml b/pkg/porter/testdata/list/expected-output.yaml new file mode 100644 index 000000000..09e56e376 --- /dev/null +++ b/pkg/porter/testdata/list/expected-output.yaml @@ -0,0 +1,22 @@ +- schemaType: Installation + schemaVersion: 1.0.1 + id: 01FZVC5AVP8Z7A78CSCP1EJ604 + name: mywordpress + namespace: dev + bundle: {} + status: + runId: "" + action: "" + resultId: "" + resultStatus: succeeded + created: 2020-04-18T01:02:03.000000004Z + modified: 2020-04-18T01:02:03.000000004Z + installed: null + uninstalled: null + bundleReference: "" + bundleVersion: v1.2.3 + bundleDigest: "" + _calculated: + resolvedParameters: [] + displayInstallationState: defined + displayInstallationStatus: succeeded diff --git a/pkg/porter/testdata/list/no-reference-expected-output.txt b/pkg/porter/testdata/list/no-reference-expected-output.txt new file mode 100644 index 000000000..2fd40a2bc --- /dev/null +++ b/pkg/porter/testdata/list/no-reference-expected-output.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------- + NAMESPACE NAME VERSION STATE STATUS MODIFIED +------------------------------------------------------------------- + dev mywordpress v1.2.3 defined succeeded 2020-04-18 diff --git a/pkg/porter/testdata/schema.json b/pkg/porter/testdata/schema.json index 731aad718..e583144a4 100644 --- a/pkg/porter/testdata/schema.json +++ b/pkg/porter/testdata/schema.json @@ -19,23 +19,6 @@ }, "type": "array" }, - "bundle": { - "description": "The defintion of a bundle reference", - "properties": { - "reference": { - "description": "The full bundle reference for the dependency in the format REGISTRY/NAME:TAG", - "type": "string" - }, - "version": { - "description": "Bundle version contstraint for version matching, see https://github.com/Masterminds/semver/blob/master/README.md#checking-version-constraints", - "type": "string" - } - }, - "required": [ - "reference" - ], - "type": "object" - }, "credential": { "description": "Credential defines a particular credential, and where it should be placed in the invocation image", "properties": { @@ -89,19 +72,19 @@ "dependency": { "additionalProperties": false, "properties": { - "bundle": { - "$ref": "#/definitions/bundle" - }, "name": { "type": "string" }, "parameters": { "type": "object" + }, + "reference": { + "type": "string" } }, "required": [ "name", - "bundle" + "reference" ], "type": "object" }, From 62314c799aa2cebd81b05d255739afd420ccb59f Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 15:11:16 +0700 Subject: [PATCH 18/23] Add unit test for displayInstallation's state and status Signed-off-by: joshuabezaleel --- pkg/porter/list_test.go | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/pkg/porter/list_test.go b/pkg/porter/list_test.go index fcb88a233..e7eef99f1 100644 --- a/pkg/porter/list_test.go +++ b/pkg/porter/list_test.go @@ -201,3 +201,68 @@ func TestPorter_PrintInstallations(t *testing.T) { }) } } + +func TestPorter_setDisplayInstallationState(t *testing.T) { + p := NewTestPorter(t) + defer p.Close() + + installation := p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues) + displayInstallationState := setDisplayInstallationState(installation) + require.Equal(t, StateDefined, displayInstallationState) + + run := p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) + result := p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + installation.Status.Installed = &now + displayInstallationState = setDisplayInstallationState(installation) + require.Equal(t, StateInstalled, displayInstallationState) + + run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUninstall), p.TestInstallations.SetMutableRunValues) + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + installation.Status.Uninstalled = &now + displayInstallationState = setDisplayInstallationState(installation) + require.Equal(t, StateUninstalled, displayInstallationState) +} + +func TestPorter_setDisplayInstallationStatus(t *testing.T) { + p := NewTestPorter(t) + defer p.Close() + + installation := p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues) + run := p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) + result := p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + displayInstallationStatus := setDisplayInstallationStatus(installation) + require.Equal(t, cnab.StatusSucceeded, displayInstallationStatus) + + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusFailed), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + displayInstallationStatus = setDisplayInstallationStatus(installation) + require.Equal(t, cnab.StatusFailed, displayInstallationStatus) + + run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + displayInstallationStatus = setDisplayInstallationStatus(installation) + require.Equal(t, StatusInstalling, displayInstallationStatus) + + run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUninstall), p.TestInstallations.SetMutableRunValues) + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + displayInstallationStatus = setDisplayInstallationStatus(installation) + require.Equal(t, StatusUninstalling, displayInstallationStatus) + + run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUpgrade), p.TestInstallations.SetMutableRunValues) + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + displayInstallationStatus = setDisplayInstallationStatus(installation) + require.Equal(t, StatusUpgrading, displayInstallationStatus) + + run = p.TestInstallations.CreateRun(installation.NewRun("customaction"), p.TestInstallations.SetMutableRunValues) + result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) + installation.ApplyResult(run, result) + installation.Status.Action = "customaction" + displayInstallationStatus = setDisplayInstallationStatus(installation) + require.Equal(t, "running customaction", displayInstallationStatus) +} From d4b61f3fe9e20da339671d6e3e9e803201df58c4 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 15:13:02 +0700 Subject: [PATCH 19/23] Change function name from set to get Signed-off-by: joshuabezaleel --- pkg/porter/list.go | 8 ++++---- pkg/porter/list_test.go | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/porter/list.go b/pkg/porter/list.go index 68905e481..0c56f19b7 100644 --- a/pkg/porter/list.go +++ b/pkg/porter/list.go @@ -141,8 +141,8 @@ func NewDisplayInstallation(installation storage.Installation) DisplayInstallati ParameterSets: installation.ParameterSets, Status: installation.Status, DisplayInstallationMetadata: DisplayInstallationMetadata{ - DisplayInstallationState: setDisplayInstallationState(installation), - DisplayInstallationStatus: setDisplayInstallationStatus(installation), + DisplayInstallationState: getDisplayInstallationState(installation), + DisplayInstallationStatus: getDisplayInstallationStatus(installation), }, } @@ -296,7 +296,7 @@ func (p *Porter) PrintInstallations(ctx context.Context, opts ListOptions) error } } -func setDisplayInstallationState(installation storage.Installation) string { +func getDisplayInstallationState(installation storage.Installation) string { if installation.IsInstalled() { return StateInstalled } else if installation.IsUninstalled() { @@ -306,7 +306,7 @@ func setDisplayInstallationState(installation storage.Installation) string { return StateDefined } -func setDisplayInstallationStatus(installation storage.Installation) string { +func getDisplayInstallationStatus(installation storage.Installation) string { var status string switch installation.Status.ResultStatus { diff --git a/pkg/porter/list_test.go b/pkg/porter/list_test.go index e7eef99f1..a729e2750 100644 --- a/pkg/porter/list_test.go +++ b/pkg/porter/list_test.go @@ -202,30 +202,30 @@ func TestPorter_PrintInstallations(t *testing.T) { } } -func TestPorter_setDisplayInstallationState(t *testing.T) { +func TestPorter_getDisplayInstallationState(t *testing.T) { p := NewTestPorter(t) defer p.Close() installation := p.TestInstallations.CreateInstallation(storage.NewInstallation("dev", "mywordpress"), p.TestInstallations.SetMutableInstallationValues) - displayInstallationState := setDisplayInstallationState(installation) + displayInstallationState := getDisplayInstallationState(installation) require.Equal(t, StateDefined, displayInstallationState) run := p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) result := p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) installation.Status.Installed = &now - displayInstallationState = setDisplayInstallationState(installation) + displayInstallationState = getDisplayInstallationState(installation) require.Equal(t, StateInstalled, displayInstallationState) run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUninstall), p.TestInstallations.SetMutableRunValues) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) installation.Status.Uninstalled = &now - displayInstallationState = setDisplayInstallationState(installation) + displayInstallationState = getDisplayInstallationState(installation) require.Equal(t, StateUninstalled, displayInstallationState) } -func TestPorter_setDisplayInstallationStatus(t *testing.T) { +func TestPorter_getDisplayInstallationStatus(t *testing.T) { p := NewTestPorter(t) defer p.Close() @@ -233,36 +233,36 @@ func TestPorter_setDisplayInstallationStatus(t *testing.T) { run := p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) result := p.TestInstallations.CreateResult(run.NewResult(cnab.StatusSucceeded), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) - displayInstallationStatus := setDisplayInstallationStatus(installation) + displayInstallationStatus := getDisplayInstallationStatus(installation) require.Equal(t, cnab.StatusSucceeded, displayInstallationStatus) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusFailed), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) - displayInstallationStatus = setDisplayInstallationStatus(installation) + displayInstallationStatus = getDisplayInstallationStatus(installation) require.Equal(t, cnab.StatusFailed, displayInstallationStatus) run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionInstall), p.TestInstallations.SetMutableRunValues) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) - displayInstallationStatus = setDisplayInstallationStatus(installation) + displayInstallationStatus = getDisplayInstallationStatus(installation) require.Equal(t, StatusInstalling, displayInstallationStatus) run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUninstall), p.TestInstallations.SetMutableRunValues) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) - displayInstallationStatus = setDisplayInstallationStatus(installation) + displayInstallationStatus = getDisplayInstallationStatus(installation) require.Equal(t, StatusUninstalling, displayInstallationStatus) run = p.TestInstallations.CreateRun(installation.NewRun(cnab.ActionUpgrade), p.TestInstallations.SetMutableRunValues) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) - displayInstallationStatus = setDisplayInstallationStatus(installation) + displayInstallationStatus = getDisplayInstallationStatus(installation) require.Equal(t, StatusUpgrading, displayInstallationStatus) run = p.TestInstallations.CreateRun(installation.NewRun("customaction"), p.TestInstallations.SetMutableRunValues) result = p.TestInstallations.CreateResult(run.NewResult(cnab.StatusRunning), p.TestInstallations.SetMutableResultValues) installation.ApplyResult(run, result) installation.Status.Action = "customaction" - displayInstallationStatus = setDisplayInstallationStatus(installation) + displayInstallationStatus = getDisplayInstallationStatus(installation) require.Equal(t, "running customaction", displayInstallationStatus) } From 9ede1cdde888d535763f294149d64c4fbdd367d0 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 15:31:41 +0700 Subject: [PATCH 20/23] Revert changes on test file Signed-off-by: joshuabezaleel --- pkg/porter/testdata/schema.json | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/pkg/porter/testdata/schema.json b/pkg/porter/testdata/schema.json index e583144a4..63e555431 100644 --- a/pkg/porter/testdata/schema.json +++ b/pkg/porter/testdata/schema.json @@ -19,6 +19,23 @@ }, "type": "array" }, + "bundle": { + "description": "The defintion of a bundle reference", + "properties": { + "reference": { + "description": "The full bundle reference for the dependency in the format REGISTRY/NAME:TAG", + "type": "string" + }, + "version": { + "description": "Bundle version contstraint for version matching, see https://github.com/Masterminds/semver/blob/master/README.md#checking-version-constraints", + "type": "string" + } + }, + "required": [ + "reference" + ], + "type": "object" + }, "credential": { "description": "Credential defines a particular credential, and where it should be placed in the invocation image", "properties": { @@ -72,19 +89,19 @@ "dependency": { "additionalProperties": false, "properties": { + "bundle": { + "$ref": "#/definitions/bundle" + }, "name": { "type": "string" }, "parameters": { "type": "object" - }, - "reference": { - "type": "string" } }, "required": [ "name", - "reference" + "bundle" ], "type": "object" }, @@ -675,4 +692,4 @@ ], "title": "Porter manifest json schema", "type": "object" -} +} \ No newline at end of file From 2c9263091a8a8985ecef593920fda0774e68c362 Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 15:51:02 +0700 Subject: [PATCH 21/23] add new line Signed-off-by: joshuabezaleel --- pkg/porter/testdata/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/porter/testdata/schema.json b/pkg/porter/testdata/schema.json index 63e555431..731aad718 100644 --- a/pkg/porter/testdata/schema.json +++ b/pkg/porter/testdata/schema.json @@ -692,4 +692,4 @@ ], "title": "Porter manifest json schema", "type": "object" -} \ No newline at end of file +} From b60a7a747ca465193d72123da63a822cbc91333c Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 15:54:29 +0700 Subject: [PATCH 22/23] resolve conflict Signed-off-by: joshuabezaleel --- CONTRIBUTORS.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 7c26df107..85ae68157 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -70,9 +70,5 @@ and we will add you. **All** contributors belong here. 💯 * [Chioma Onyekpere](https://github.com/Simpcyclassy) * [Hrittik Roy](https://github.com/hrittikhere) * [Tanmay Chaudhry](https://github.com/tchaudhry91) -<<<<<<< HEAD -* [Kevin Barbour](https://github.com/kevinbarbour) -======= * [Kevin Barbour](https://github.com/kevinbarbour) * [Epsxy](https://github.com/epsxy) ->>>>>>> release/v1 From 8ea1073e1ea6ebce4c87578f093b182fe264d67e Mon Sep 17 00:00:00 2001 From: joshuabezaleel Date: Thu, 23 Jun 2022 16:10:24 +0700 Subject: [PATCH 23/23] fix comment Signed-off-by: joshuabezaleel --- pkg/storage/installation_provider_helpers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/storage/installation_provider_helpers.go b/pkg/storage/installation_provider_helpers.go index f9ef0423e..e893bce9a 100644 --- a/pkg/storage/installation_provider_helpers.go +++ b/pkg/storage/installation_provider_helpers.go @@ -61,7 +61,7 @@ func (p *TestInstallationProvider) SetMutableInstallationValues(i *Installation) i.Status.Modified = now } -// CreateRun creates a new claim and saves it. +// CreateRun creates a new test run and saves it. func (p *TestInstallationProvider) CreateRun(r Run, transformations ...func(r *Run)) Run { for _, transform := range transformations { transform(&r) @@ -78,7 +78,7 @@ func (p *TestInstallationProvider) SetMutableRunValues(r *Run) { r.Created = now } -// CreateResult creates a new result from the specified claim and saves it. +// CreateResult creates a new test result and saves it. func (p *TestInstallationProvider) CreateResult(r Result, transformations ...func(r *Result)) Result { for _, transform := range transformations { transform(&r) @@ -95,7 +95,7 @@ func (p *TestInstallationProvider) SetMutableResultValues(r *Result) { r.Created = now } -// CreateOutput creates a new output from the specified claim and result and saves it. +// CreateOutput creates a new test output and saves it. func (p *TestInstallationProvider) CreateOutput(o Output, transformations ...func(o *Output)) Output { for _, transform := range transformations { transform(&o)