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

Change printer for displayParam to display with list showing values like porter param show #2824

Merged

Conversation

troy0820
Copy link
Member

@troy0820 troy0820 commented Jul 13, 2023

What does this change

Fixes the param list to show the output of the params and not just the name. The outputs for yaml and json show the params when queried and providing that functionality to fix the issue is why this fix is necessary.

What issue does it fix

Closes #2785

Notes for the reviewer

This can be up for discussion if we do not intend to fix this, this way

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

pkg/porter/parameters.go Outdated Show resolved Hide resolved
@troy0820
Copy link
Member Author

porter parameters show porter-hello
Name: porter-hello
Created: 1 hour ago
Modified: 1 hour ago

---------------------------------------------
  Name            Local Source  Source Type
---------------------------------------------
  mysql_user      fake-user     env
  wordpress-user  faker-user    envporter parameters list porter-hello -o plaintext
-------------------------------------------------
  NAME            VALUE  STRATEGY    MODIFIED
-------------------------------------------------
  mysql_user      env    fake-user   1 hour ago
  wordpress-user  env    faker-user  1 hour agoporter param list porter-hello -o plaintext
-------------------------------------------------
  NAME            VALUE  STRATEGY    MODIFIED
-------------------------------------------------
  mysql_user      env    fake-user   1 hour ago
  wordpress-user  env    faker-user  1 hour ago

@AGMETEOR
Copy link
Contributor

Hey @troy0820 I hope I am allowed to add my review to this. This looks good and fixes the bug. I just noticed we could maybe also populate the Type column when we run porter parameters show

pkg/porter/parameters.go Outdated Show resolved Hide resolved
@troy0820
Copy link
Member Author

Hey @troy0820 I hope I am allowed to add my review to this. This looks good and fixes the bug. I just noticed we could maybe also populate the Type column when we run porter parameters show

Yes, please any feedback is valuable. I noticed from the comment that the “strategy” could be TYPE which goes with what the other command shows.

I can change this to that

@troy0820
Copy link
Member Author

Updated PR with tests to show p.PrintTableParameterSet in p.PrintParameters would satisfy the PR requirements

err := p.PrintParameters(context.Background(), opts)
require.NoError(t, err, "an error should not have occurred")
gotOutput := p.TestConfig.TestContext.GetOutput()
test.CompareGoldenFile(t, "testdata/parameters/mypsettable.txt", gotOutput)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@troy0820
Copy link
Member Author

@schristoff Here is the issue #2836

I can work on that as well.

@schristoff
Copy link
Member

/azp run porter-integration

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 2824 in repo getporter/porter

@AGMETEOR
Copy link
Contributor

#2836

@troy0820 do you mind if I take that off your hands?

@troy0820
Copy link
Member Author

@AGMETEOR I think we want to talk about this in the community office hours. It's this week but I don't mind if you start with the initial implementation.

@AGMETEOR
Copy link
Contributor

@AGMETEOR I think we want to talk about this in the community office hours. It's this week but I don't mind if you start with the initial implementation.

Could you kindly send me an invitation to #porter slack channel?

@troy0820
Copy link
Member Author

https://getporter.org/community/

https://communityinviter.com/apps/cloud-native/cncf

@troy0820
Copy link
Member Author

---------------------------------------------------
  NAMESPACE  NAME  TYPE    VALUE       MODIFIED
---------------------------------------------------
             foo   secret  foo_secret  1983-04-18

@troy0820
Copy link
Member Author

troy0820 commented Jul 24, 2023

-----------------------------------------------
  NAMESPACE  NAME  TYPE    VALUE   MODIFIED
-----------------------------------------------
             foo   secret  ******  1983-04-18

edited:
This is fixed to show the output being obfuscated if it is an "env" or a "secret" _(not using ResolvedValue)_. @AGMETEOR is handling the fix to be more global around params.

No bug on the name of the secret because the value is not shown as demonstrated in the porter params show command.

edited:

-----------------------------------------------
  NAMESPACE  NAME  TYPE    VALUE   MODIFIED
-----------------------------------------------
             foo   secret  foo_secret 1983-04-18

@troy0820 troy0820 force-pushed the troy0820/fix-printer-for-list-params branch 2 times, most recently from fc0bc4a to 91c9797 Compare July 24, 2023 21:11
pkg/porter/parameters.go Outdated Show resolved Hide resolved
Signed-off-by: Troy Connor <[email protected]>
@troy0820 troy0820 force-pushed the troy0820/fix-printer-for-list-params branch from 91c9797 to 58f8ec6 Compare July 26, 2023 19:35
@troy0820
Copy link
Member Author

Because issue #2836 is closed as the value of the secret is never shown but the name of the secret, there is no need to obfuscate the secret(s) when displaying the params list in json, yaml, or plaintext.

@schristoff
Copy link
Member

ADO pipeline is still broken, this is an Azure issue, not a me issue. Just going to bypass and merge. :/

@schristoff schristoff merged commit 39f47c8 into getporter:main Jul 28, 2023
14 checks passed
AGMETEOR pushed a commit to AGMETEOR/porter that referenced this pull request Aug 9, 2023
…ike `porter param show` (getporter#2824)

* change printer for displayParam to display with list showing values like param show

Signed-off-by: Troy Connor <[email protected]>
Signed-off-by: Allan Guwatudde <[email protected]>
AGMETEOR pushed a commit to AGMETEOR/porter that referenced this pull request Aug 9, 2023
…ike `porter param show` (getporter#2824)

* change printer for displayParam to display with list showing values like param show

Signed-off-by: Troy Connor <[email protected]>
Signed-off-by: Allan Guwatudde <[email protected]>
AGMETEOR pushed a commit to AGMETEOR/porter that referenced this pull request Aug 9, 2023
…ike `porter param show` (getporter#2824)

* change printer for displayParam to display with list showing values like param show

Signed-off-by: Troy Connor <[email protected]>
Signed-off-by: Allan Guwatudde <[email protected]>
AGMETEOR pushed a commit to AGMETEOR/porter that referenced this pull request Aug 9, 2023
…ike `porter param show` (getporter#2824)

* change printer for displayParam to display with list showing values like param show

Signed-off-by: Troy Connor <[email protected]>
Signed-off-by: Allan Guwatudde <[email protected]>
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.

porter param list doesn't display params
3 participants