Skip to content

Commit

Permalink
Merge pull request #1761 from carolynvs/hide-internal-outputs
Browse files Browse the repository at this point in the history
Hide internal outputs from porter installation outputs list
  • Loading branch information
carolynvs authored Sep 17, 2021
2 parents a628df6 + 3864352 commit 09840b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/porter/outputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func NewDisplayValuesFromOutputs(bun cnab.ExtendedBundle, outputs claims.Outputs
displayOutputs := make(DisplayValues, 0, outputs.Len())
for i := 0; i < outputs.Len(); i++ {
output, _ := outputs.GetByIndex(i)

if bun.IsInternalOutput(output.Name) {
continue
}

do := &DisplayValue{Name: output.Name}
do.SetValue(output.Value)
schema, ok := output.GetSchema(bun)
Expand Down
9 changes: 9 additions & 0 deletions pkg/porter/outputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
"longfoo": &definition.Schema{
Type: "string",
},
"porter-state": &definition.Schema{
Type: "string",
Comment: "porter-internal", // This output should be hidden because it's internal
},
},
Outputs: map[string]bundle.Output{
"foo": {
Expand All @@ -91,6 +95,10 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
"longfoo": {
Definition: "longfoo",
},
"porter-state": {
Definition: "porter-state",
Path: "/cnab/app/outputs/porter-state.tgz",
},
},
}

Expand All @@ -100,6 +108,7 @@ func TestPorter_PrintBundleOutputs(t *testing.T) {
p.TestClaims.CreateOutput(r.NewOutput("foo", []byte("foo-output")))
p.TestClaims.CreateOutput(r.NewOutput("bar", []byte("bar-output")))
p.TestClaims.CreateOutput(r.NewOutput("longfoo", []byte("DFo6Wc2jDhmA7Yt4PbHyh8RO4vVG7leOzK412gf2TXNPJhuCUs1rB29nkJJd4ICimZGpyWpMGalSvDxf")))
p.TestClaims.CreateOutput(r.NewOutput("porter-state", []byte("porter-state.tgz contents")))

opts := OutputListOptions{
sharedOptions: sharedOptions{
Expand Down

0 comments on commit 09840b4

Please sign in to comment.