Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve parameter set loading from file if not then store. #1730

Closed
wants to merge 69 commits into from

Conversation

fibonacci1729
Copy link
Contributor

What does this change

When we load a parameter set, first we check if it is a file on the local filesystem. If so load the parameter set from the file. Otherwise assume it is a parameter set name and load it normally.

What issue does it fix

Closes #1217

Notes for the reviewer

N/A

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml)

carolynvs and others added 30 commits May 11, 2021 14:05
Signed-off-by: Carolyn Van Slyck <[email protected]>
* Remove packr dependency
* Switch to go:embed
* Upgrade to Go 1.16. Consumers of porter will need to be on this
version to compile.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Upgrade to Go 1.16 and use go:embed
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
This updates our commands that interact with Go to not explictly set
GO111MODULE=on. Go mods are enabled by default in 1.16.

Before the build targets are executed, they check that you have Go 1.16+

Signed-off-by: Carolyn Van Slyck <[email protected]>
Remove GO111MODULE and require Go 1.16
Only the exec mixin should be installed by default with Porter. All
other mixins and plugins should be managed separately.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
* rename build provider
* Add new build driver for buildkit
    * Add experimental flags to config file. These features are disabled
by default.
    * Add experimental flag for "build-drivers". This allows specifying the
build driver, e.g. docker, buildkit, in the config file.
    * Add driver for buildkit.
* Add --experimental flag and refactor config/data
    * Add --experimental flag that accepts a comma separated list of feature
flags. Right now we only support "build-drivers".
    * Refactor porter's config and data structures so that we can't get nil
pointer exceptions or try to access the configuration data before it is
loaded.
    * Move helper functions to Config so that they are easier to find.
    * Remove helper functions for config values that aren't needed anymore
because its safe to directly access the bound field going forward.
    * Use a fork of viper with a patch for a bug in how we load
configuration when a config file is not found. We should still bind to
environment variables.

* Fix review feedback
    * Fix setting defaults on viper config
    * Add missing example to custom dockerfile page
    * Fix comments
    * Bind --driver to the command flag, not the config struct directly
    * Add check to AddTestDirectoryFromRoot

* Load defaults before applying config to flags

I've added a regression test to ensure that when we set a flag for
something that falls back to the config, but it also has a flag default
set, that the config value is properly bound to the flag.

Fixes the edge case of bad config data and the user running porter build
without specifying the --driver flag. Previously it was defaulting to
the flag's default instead of binding to the config value.

I've also tweaked the TestPorter so that it doesn't accidentally load
the config and env vars from your dev machine when running tests.

* Support setting experimental flags programmatically

Make it easier for tests or downstream consumers of our library to
enable experimental flags quickly without having to understand our
configuration system.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
* Add support for maintainers by including MaintainerDefition to manifest

Signed-off-by: Thorsten Hans <[email protected]>

* Set maintainers in CNAB bundle definition

Signed-off-by: Thorsten Hans <[email protected]>

* docs: add maintainers to docs

Signed-off-by: Thorsten Hans <[email protected]>

* fix: use example.com as test-domain

Signed-off-by: Thorsten Hans <[email protected]>

* fix: update simple manifest digest

Signed-off-by: Thorsten Hans <[email protected]>

* fix: use example.com as test-domain

Signed-off-by: Thorsten Hans <[email protected]>

* feat: add maintainers to porter schema

Signed-off-by: Thorsten Hans <[email protected]>
I have taken the PR started by Jennifer in getporter#1324 and included some of my
edits.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Co-authored-by: Jennifer Davis <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
…orter#1573)

* Rearrange dependencies syntax to be nested in 'requires' object

Signed-off-by: Thorsten Hans <[email protected]>

* Update docs for dependency rearrangement

Signed-off-by: Thorsten Hans <[email protected]>

* fix: do not use pointer for dependencies

Signed-off-by: Thorsten Hans <[email protected]>

* fix: remove invalid 'requires' from dependency output documentation

Signed-off-by: Thorsten Hans <[email protected]>

* fix: add requires to docs, samples, and tests where I missed it

Signed-off-by: Thorsten Hans <[email protected]>

* feat: add dependencies.requires to porter schema

Signed-off-by: Thorsten Hans <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
* fixed to count only internal params

Signed-off-by: div_bhasin <[email protected]>

* fix test

Signed-off-by: div_bhasin <[email protected]>

* fix mistake

Signed-off-by: div_bhasin <[email protected]>
I forgot to include the generated documentation when I added the
--experimental flag for buildkit.

Signed-off-by: Carolyn Van Slyck <[email protected]>
* jsonschema-lock is finally merged and we can get rid of our fork
* Allow numbers in bundle.json again
* Add support for params of type array
* Add ValidateSchema function
* Add output validation
* Validate parameter defaults
* Validate param regardless of if override or default
* Fix retrieval of outputs when characters in the result id are in the
output name
* Add support for params of object type in ConvertValue (getporter#251)
* Use alternate canonical json library
* Bump docker libraries to newer version

Signed-off-by: Carolyn Van Slyck <[email protected]>
* Display more installation information with show

Add the following fields to the porter show output:

* Bundle Repository, e.g. getporter/porter-hello
* Bundle Version
* Parameters used last

All of this data comes from the last claim associated with the
installation.

I have also consolidated the print logic for parameters and outputs so
that they both truncate and mask sensitive values the same way.
If someone wants the full unmasked values, right now they need to use
--ouput json|yaml instead. In some places we had not defined json/yaml
marshal tags so I added them.

$ porter show mysql
Name: mysql
Bundle: getporter/mysql
Version: 0.1.3
Created: 7 minutes ago
Modified: 39 seconds ago

Parameters:
--------------------------------------------
  Name           Type    Value
--------------------------------------------
  database-name  string  "mydb"
  mysql-name     string  "porter-ci-mysql"
  mysql-user     string  "mysql-admin"
  namespace      string  ""

Outputs:
---------------------------------------
  Name                 Type    Value
---------------------------------------
  mysql-password       string  ******
  mysql-root-password  string  ******

History:
-------------------------------------------------------------------------
  Run ID                      Action   Timestamp       Status  Has Logs
-------------------------------------------------------------------------
  01F6FZD5Z0NMSM4TZ9SGDF6Z6G  install  7 minutes ago   failed  true

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Update doc example output to include bundle ref

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Do not show Bundle reference when unset

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
* feat(manifest): add parameter/output schema validation

Signed-off-by: Vaughn Dice <[email protected]>

* incorporate review feedback

Signed-off-by: Vaughn Dice <[email protected]>

* incorporate review feedback

Signed-off-by: Vaughn Dice <[email protected]>
Include the custom json schema (that includes file types) in the
definition of paramters and outputs so that VS Code and other editors
will provide autocomplete for those fields.

Signed-off-by: Carolyn Van Slyck <[email protected]>
carolynvs and others added 23 commits June 16, 2021 10:12
)

* remove support for deprecated manifest fields

Signed-off-by: Vaughn Dice <[email protected]>

* bump mysql bundle version with non-deprecated tag field; use in archive test

Signed-off-by: Vaughn Dice <[email protected]>

* incorporate review feedback

Signed-off-by: Vaughn Dice <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
This removes our fork of jsonschema now that it has been merged
upstream.

Signed-off-by: Carolyn Van Slyck <[email protected]>
* Support the Installation Spec

* Change storage protocol to mimic mongo.
* Switch the filesystem plugin to use a mongo instance in a container.
* Add a mongo plugin.
* Add installation document and rename claim -> run.
* Move all storage document formats and data access into porter.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix stuff found after reading my own code...

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Rename filesystem plugin to mongodb-docker

If you are still using the filesystem plugin you will see the following
error:

Error: could not list installations: could not load storage plugin: unsupported internal storage plugin specified storage.porter.filesystem

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix use of SchemaVersion

Our documents store PORTER'S schema for the document. If we need to
convert that document to a CNAB representation, then we will stamp the
converted document with the appropriate schema version for that spec.

Some docs don't need it at all and I've removed it.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Remove commented out code and document claimstore interface

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Clarify debug statement for the current namespace

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix copy/paste error

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix typos

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix names for plugins in our config file

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Document built-in plugins

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix padding for list pages

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix formatting

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix exmaple for mongodb-docker

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
* Support labels

Add labels to installations, credential sets and parameter sets.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Review feedback

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Moar feedback

Signed-off-by: Carolyn Van Slyck <[email protected]>
Add an --all-namespaces flag to porter installation|credential|parameter list commands. This is the equivalent of list -n "*"

Signed-off-by: Carolyn Van Slyck <[email protected]>
--tag was used in the early days of porter and was replaced by
--registry and --reference. In v1 it is no longer supported.

Signed-off-by: Carolyn Van Slyck <[email protected]>
* Add apply command for creds and params

Add a new command for credential and parameter sets which allow you to
apply changes (or create net new) from a file.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix exmaple

Signed-off-by: Carolyn Van Slyck <[email protected]>
The old help text was using the porter emoji of old and also didn't
describe itself well.

Let's use the same text that we have on the homepage to explain what the
tool is.

Signed-off-by: Carolyn Van Slyck <[email protected]>
…ption

Update help text description of porter
* Always pull the invocation image

Sometimes the invocation image only exists in the local docker cache but
was never pulled. In that case, there isn't a repository digest for the
image in the cache and it will fail validation.

Always pulling, will ensure that the repo digest is always populated to
avoid unexpected errors about missing digests.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Finish my thought

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Brian Hardock <[email protected]>
@fibonacci1729 fibonacci1729 changed the title Release/v1 Improve parameter set loading from file if not then store. Aug 23, 2021
@fibonacci1729 fibonacci1729 reopened this Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve auto-detect of name vs filepath for Cred/Param Sets
5 participants