-
Notifications
You must be signed in to change notification settings - Fork 213
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
Standardize table printing #1876
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only use a single table printing library, with support for proper column wrapping when data is a column is very long. We have been having trouble with column data being so wide the table is unreadable when the terminal forces the text to wrap. This also updates all of Porter to use the single library, which has a slightly different output (it adds a line under the table headers). When I went through and updated all the expected console output tests, I took the opportuntity to use the improved test.CompareToGoldenFile helper, which makes syncing the expected test output much easier. Signed-off-by: Carolyn Van Slyck <[email protected]>
Update tests to use test.CompareGoldenFile Signed-off-by: Carolyn Van Slyck <[email protected]>
When the golden file for a test doesn't exist, create it. This makes it easier to get started using golden files without having to create the empty file first. You can just edit the test to use that helper and it will make the file for you when run with mage updatetestfiles Signed-off-by: Carolyn Van Slyck <[email protected]>
Here is what the output looks like for a reasonably complex bundle now: $ porter explain -r ghcr.io/getporter/porter-operator:v0.3.0
Name: porter-operator
Description: The Porter Operator for Kubernetes. Execute bundles on a Kubernetes cluster.
Version: 0.3.0
Porter Version: v1.0.0-alpha.8
Credentials:
---------------------------------------------------------------------
Name Description Required Applies To
---------------------------------------------------------------------
kubeconfig Kubeconfig file for cluster true All Actions
where the operator should be
installed
Parameters:
------------------------------------------------------------------------------------------------------------------
Name Description Type Default Required Applies To
------------------------------------------------------------------------------------------------------------------
installationServiceAccount Name of the service account string false configureNamespace
to run installation with.
If set, you are responsible
for creating this service
account and giving it required
permissions.
namespace Setup Porter in this namespace string <nil> true configureNamespace
porterConfig Porter config file, in yaml, file false configureNamespace
same as ~/.porter/config.yaml
porterRepository Docker image repository of string false configureNamespace
the Porter agent. Defaults to
ghcr.io/getporter/porter.
porterVersion Version of the Porter agent, string false configureNamespace
e.g. latest, canary, v0.33.0.
Defaults to latest.
pullPolicy Specifies how the Porter agent string false configureNamespace
image should be pulled. Does
not affect how bundles are
pulled. Defaults to PullAlways
for latest and canary, and
PullIfNotPresent otherwise.
serviceAccount Name of the service account string porter-agent false configureNamespace
to run the Porter agent.
If set, you are responsible
for creating this service
account and binding it to
the porter-agent ClusterRole.
Defaults to the porter-agent
account created by the
configureNamespace custom
action.
volumeSize Size of the volume shared string false configureNamespace
between Porter and the bundles
it executes. Defaults to 64Mi.
Actions:
----------------------------------------------------------------------------------------
Name Description Modifies Installation Stateless
----------------------------------------------------------------------------------------
configureNamespace Add necessary rbac, service false false
account and configuration
to use Porter Operator in
a namespace. Creates the
namespace if it does not
already exist.
removeData Remove Porter Operator data, false false
such as namespaces used
with configureNamespace,
configuration, jobs, etc.
These are not removed during
uninstall.
This bundle uses the following tools: exec, helm3, kubernetes.
To install this bundle run the following command, passing --param KEY=VALUE for any parameters you want to customize:
porter credentials generate mycreds --reference ghcr.io/getporter/porter-operator:v0.3.0
porter install --reference ghcr.io/getporter/porter-operator:v0.3.0 --param namespace=TODO --cred mycreds |
carolynvs
requested review from
joshuabezaleel,
vdice and
VinozzZ
and removed request for
vdice and
jeremyrickard
January 27, 2022 20:56
vdice
approved these changes
Jan 28, 2022
joshuabezaleel
pushed a commit
to joshuabezaleel/porter
that referenced
this pull request
Feb 8, 2022
* Standardize table printing Only use a single table printing library, with support for proper column wrapping when data is a column is very long. We have been having trouble with column data being so wide the table is unreadable when the terminal forces the text to wrap. This also updates all of Porter to use the single library, which has a slightly different output (it adds a line under the table headers). When I went through and updated all the expected console output tests, I took the opportuntity to use the improved test.CompareToGoldenFile helper, which makes syncing the expected test output much easier. Signed-off-by: Carolyn Van Slyck <[email protected]> * Update code to use new table printer Update tests to use test.CompareGoldenFile Signed-off-by: Carolyn Van Slyck <[email protected]> * Improve test.CompareGoldenFile When the golden file for a test doesn't exist, create it. This makes it easier to get started using golden files without having to create the empty file first. You can just edit the test to use that helper and it will make the file for you when run with mage updatetestfiles Signed-off-by: Carolyn Van Slyck <[email protected]> Signed-off-by: joshuabezaleel <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change
Only use a single table printing library, with support for proper column
wrapping when data is a column is very long. We have been having trouble
with column data being so wide the table is unreadable when the terminal
forces the text to wrap.
This also updates all of Porter to use the single library, which has a
slightly different output (it adds a line under the table headers). When
I went through and updated all the expected console output tests, I took
the opportuntity to use the improved test.CompareToGoldenFile helper,
which makes syncing the expected test output much easier.
What issue does it fix
Fixes #1448
Notes for the reviewer
I split this into 3 commits for easier reviewing and will squash when I merge.
Checklist
Reviewer Checklist