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

porter explalin does not show parameters that have an output source #2905

Open
lbergnehr opened this issue Sep 13, 2023 · 2 comments
Open

porter explalin does not show parameters that have an output source #2905

lbergnehr opened this issue Sep 13, 2023 · 2 comments
Labels
bug Oops, sorry!

Comments

@lbergnehr
Copy link

lbergnehr commented Sep 13, 2023

Describe the bug

When specifying a parameter to have an output source, like this:

parameters:
  - name: test
    description: some test
    source:
      output: test

the parameter is not displayed in the list of parameters in porter explain on the bundle.
Failing test repro in #2904 .

To Reproduce

  1. Create a new porter bundle using porter create test
  2. Edit the porter.yaml to something like this:
# Optional indicator of the resource type of this file
schemaType: Bundle

# Version of the porter.yaml schema used by this file.
schemaVersion: 1.0.1

# Name of the bundle
name: porter-hello

# Version of the bundle. Change this each time you modify a published bundle.
version: 0.1.0

# Description of the bundle and what it does.
description: "An example Porter configuration"

# Registry where the bundle is published to by default
registry: "localhost:5000"

mixins:
  - exec

parameters:
  - name: mysql_user
    type: string
    default: wordpress
    source:
      output: test

outputs:
  - name: test

install:
  - exec:
      command: ':'

uninstall:
  - exec:
      command: ':'
  1. Run porter explain
  2. The output is something like this:
Name: porter-hello
Description: An example Porter configuration
Version: 0.1.0
Porter Version: v1.0.14

Outputs:
------------------------------------------
  Name  Description  Type    Applies To
------------------------------------------
  test               string  All Actions

This bundle uses the following tools: exec.

To install this bundle run the following command, passing --param KEY=VALUE for any parameters you want to customize:
porter install

Expected behavior

The mysql_user parameter should be displayed in a parameter list.

Version

porter v1.0.14 (0e739d8)

@lbergnehr lbergnehr added the bug Oops, sorry! label Sep 13, 2023
@ludfjig
Copy link
Contributor

ludfjig commented Sep 21, 2023

I am not super familiar with this, but I believe that this is intentional, and that we don't want to show parameters with external sources, see commit message f92025b . Relevant code:

if bun.IsInternalParameter(p) || bun.ParameterHasSource(p) {
continue
}

@lbergnehr
Copy link
Author

Posting the commit message here as well:

Some outputs and parameters are really porter "plumbing". They are used
by porter to implement things, like state or persistent parameters, but
aren't intended to be set or used by the end-user.

When we print out how to use a bundle with porter explain, those
shoudn't be displayed.

  • Parameters with sources - these will be set by Porter internally.
  • Outputs and Parameters that support bundle state.

I think this is in contrast with the current documentation, which I think communicates that while a source can be used as a default value, the parameter value can still be set explicitly as well (which would warrant it being visible in explain):

Parameters can also use the value from an output from the current bundle or one of its dependencies as its default value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Oops, sorry!
Projects
Status: No status
Development

No branches or pull requests

2 participants