From 6e25fd1c03e103b4ac4cc738b8a4d8ca1b429e4d Mon Sep 17 00:00:00 2001 From: Sambhav Kothari Date: Mon, 29 Mar 2021 20:58:06 +0100 Subject: [PATCH] Add buildpack name to buildpack and builder metadata Signed-off-by: Sambhav Kothari --- .../inspect_builder_nested_depth_2_output.txt | 28 +++++++++---------- .../inspect_builder_nested_output.txt | 28 +++++++++---------- .../inspect_builder_nested_output_json.txt | 6 ++++ .../inspect_builder_nested_output_toml.txt | 6 ++++ .../inspect_builder_nested_output_yaml.txt | 6 ++++ .../pack_fixtures/inspect_builder_output.txt | 20 ++++++------- .../inspect_buildpack_output.txt | 6 ++-- inspect_builder_test.go | 8 ++++-- inspect_buildpack.go | 1 + inspect_buildpack_test.go | 8 +++++- internal/builder/writer/human_readable.go | 4 +-- .../builder/writer/human_readable_test.go | 24 ++++++++-------- internal/buildpackage/builder_test.go | 2 ++ internal/commands/buildpack_inspect_test.go | 23 +++++++++------ internal/commands/inspect_buildpack.go | 4 +-- internal/commands/inspect_buildpack_test.go | 2 ++ internal/dist/buildpack.go | 1 + internal/dist/dist.go | 2 ++ 18 files changed, 111 insertions(+), 68 deletions(-) diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_nested_depth_2_output.txt b/acceptance/testdata/pack_fixtures/inspect_builder_nested_depth_2_output.txt index 91c7ab5ea3..438fa03fea 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_nested_depth_2_output.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_nested_depth_2_output.txt @@ -31,13 +31,13 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - - simple/nested-level-1 nested-l1-version - - simple/nested-level-2 nested-l2-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - + simple/nested-level-1 - nested-l1-version - + simple/nested-level-2 - nested-l2-version - Detection Order: └ Group #1: @@ -77,13 +77,13 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - - simple/nested-level-1 nested-l1-version - - simple/nested-level-2 nested-l2-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - + simple/nested-level-1 - nested-l1-version - + simple/nested-level-2 - nested-l2-version - Detection Order: └ Group #1: diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output.txt b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output.txt index 704e14cda6..7756ed690a 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output.txt @@ -31,13 +31,13 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - - simple/nested-level-1 nested-l1-version - - simple/nested-level-2 nested-l2-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - + simple/nested-level-1 - nested-l1-version - + simple/nested-level-2 - nested-l2-version - Detection Order: └ Group #1: @@ -79,13 +79,13 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - - simple/nested-level-1 nested-l1-version - - simple/nested-level-2 nested-l2-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - + simple/nested-level-1 - nested-l1-version - + simple/nested-level-2 - nested-l2-version - Detection Order: └ Group #1: diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_json.txt b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_json.txt index 7b7d2a9668..b85b9f4f10 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_json.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_json.txt @@ -42,15 +42,18 @@ "buildpacks": [ { "id": "noop.buildpack", + "name": "NOOP Buildpack", "version": "noop.buildpack.later-version", "homepage": "http://geocities.com/cool-bp" }, { "id": "noop.buildpack", + "name": "NOOP Buildpack", "version": "noop.buildpack.version" }, { "id": "read/env", + "name": "Read Env Buildpack", "version": "read-env-version" }, { @@ -133,15 +136,18 @@ "buildpacks": [ { "id": "noop.buildpack", + "name": "NOOP Buildpack", "version": "noop.buildpack.later-version", "homepage": "http://geocities.com/cool-bp" }, { "id": "noop.buildpack", + "name": "NOOP Buildpack", "version": "noop.buildpack.version" }, { "id": "read/env", + "name": "Read Env Buildpack", "version": "read-env-version" }, { diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_toml.txt b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_toml.txt index 9f7064b021..cd7795316e 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_toml.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_toml.txt @@ -35,15 +35,18 @@ default = false [[remote_info.buildpacks]] id = "noop.buildpack" + name = "NOOP Buildpack" version = "noop.buildpack.later-version" homepage = "http://geocities.com/cool-bp" [[remote_info.buildpacks]] id = "noop.buildpack" + name = "NOOP Buildpack" version = "noop.buildpack.version" [[remote_info.buildpacks]] id = "read/env" + name = "Read Env Buildpack" version = "read-env-version" [[remote_info.buildpacks]] @@ -109,15 +112,18 @@ default = false [[local_info.buildpacks]] id = "noop.buildpack" + name = "NOOP Buildpack" version = "noop.buildpack.later-version" homepage = "http://geocities.com/cool-bp" [[local_info.buildpacks]] id = "noop.buildpack" + name = "NOOP Buildpack" version = "noop.buildpack.version" [[local_info.buildpacks]] id = "read/env" + name = "Read Env Buildpack" version = "read-env-version" [[local_info.buildpacks]] diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_yaml.txt b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_yaml.txt index 45cb4f06e0..0692fec054 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_yaml.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_nested_output_yaml.txt @@ -28,11 +28,14 @@ remote_info: - name: {{.run_image_mirror}} buildpacks: - id: noop.buildpack + name: NOOP Buildpack version: noop.buildpack.later-version homepage: http://geocities.com/cool-bp - id: noop.buildpack + name: NOOP Buildpack version: noop.buildpack.version - id: read/env + name: Read Env Buildpack version: read-env-version - id: simple/layers version: simple-layers-version @@ -78,11 +81,14 @@ local_info: - name: {{.run_image_mirror}} buildpacks: - id: noop.buildpack + name: NOOP Buildpack version: noop.buildpack.later-version homepage: http://geocities.com/cool-bp - id: noop.buildpack + name: NOOP Buildpack version: noop.buildpack.version - id: read/env + name: Read Env Buildpack version: read-env-version - id: simple/layers version: simple-layers-version diff --git a/acceptance/testdata/pack_fixtures/inspect_builder_output.txt b/acceptance/testdata/pack_fixtures/inspect_builder_output.txt index fefa49715a..1e48d1a4cf 100644 --- a/acceptance/testdata/pack_fixtures/inspect_builder_output.txt +++ b/acceptance/testdata/pack_fixtures/inspect_builder_output.txt @@ -31,11 +31,11 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - Detection Order: └ Group #1: @@ -73,11 +73,11 @@ Run Images: {{.run_image_mirror}} Buildpacks: - ID VERSION HOMEPAGE - noop.buildpack noop.buildpack.later-version http://geocities.com/cool-bp - noop.buildpack noop.buildpack.version - - read/env read-env-version - - simple/layers simple-layers-version - + ID NAME VERSION HOMEPAGE + noop.buildpack NOOP Buildpack noop.buildpack.later-version http://geocities.com/cool-bp + noop.buildpack NOOP Buildpack noop.buildpack.version - + read/env Read Env Buildpack read-env-version - + simple/layers - simple-layers-version - Detection Order: └ Group #1: diff --git a/acceptance/testdata/pack_fixtures/inspect_buildpack_output.txt b/acceptance/testdata/pack_fixtures/inspect_buildpack_output.txt index 3352d49dcb..f032e971a3 100644 --- a/acceptance/testdata/pack_fixtures/inspect_buildpack_output.txt +++ b/acceptance/testdata/pack_fixtures/inspect_buildpack_output.txt @@ -8,9 +8,9 @@ Stacks: (none) Buildpacks: - ID VERSION HOMEPAGE - simple/layers simple-layers-version - - simple/layers/parent simple-layers-parent-version - + ID NAME VERSION HOMEPAGE + simple/layers Simple Layers Buildpack simple-layers-version - + simple/layers/parent Simple Layers Parent Buildpack simple-layers-parent-version - Detection Order: └ Group #1: diff --git a/inspect_builder_test.go b/inspect_builder_test.go index 754f46bccc..09bad8a8c2 100644 --- a/inspect_builder_test.go +++ b/inspect_builder_test.go @@ -126,7 +126,8 @@ func testInspectBuilder(t *testing.T, when spec.G, it spec.S) { { "id": "test.bp.one", "version": "test.bp.one.version", - "homepage": "http://geocities.com/cool-bp" + "homepage": "http://geocities.com/cool-bp", + "name": "one" }, { "id": "test.bp.two", @@ -197,7 +198,8 @@ func testInspectBuilder(t *testing.T, when spec.G, it spec.S) { } ], "layerDiffID": "sha256:test.bp.one.sha256", - "homepage": "http://geocities.com/cool-bp" + "homepage": "http://geocities.com/cool-bp", + "name": "one" } }, "test.bp.two": { @@ -230,6 +232,7 @@ func testInspectBuilder(t *testing.T, when spec.G, it spec.S) { { ID: "test.bp.one", Version: "test.bp.one.version", + Name: "one", Homepage: "http://geocities.com/cool-bp", }, { @@ -298,6 +301,7 @@ func testInspectBuilder(t *testing.T, when spec.G, it spec.S) { }, LayerDiffID: "sha256:test.bp.one.sha256", Homepage: "http://geocities.com/cool-bp", + Name: "one", }, }, "test.bp.two": { diff --git a/inspect_buildpack.go b/inspect_buildpack.go index dd1b366d3e..7e3371fde2 100644 --- a/inspect_buildpack.go +++ b/inspect_buildpack.go @@ -143,6 +143,7 @@ func extractBuildpacks(layersMd dist.BuildpackLayers) []dist.BuildpackInfo { for version, layerInfo := range buildpackMap { bp := dist.BuildpackInfo{ ID: buildpackID, + Name: layerInfo.Name, Version: version, Homepage: layerInfo.Homepage, } diff --git a/inspect_buildpack_test.go b/inspect_buildpack_test.go index ffcca698e2..6d93d373a7 100644 --- a/inspect_buildpack_test.go +++ b/inspect_buildpack_test.go @@ -41,6 +41,7 @@ import ( const buildpackageMetadataTag = `{ "id": "some/top-buildpack", "version": "0.0.1", + "name": "top", "homepage": "top-buildpack-homepage", "stacks": [ { @@ -144,7 +145,8 @@ const buildpackLayersTag = `{ } ], "layerDiffID":"sha256:top-buildpack-diff-id", - "homepage":"top-buildpack-homepage" + "homepage":"top-buildpack-homepage", + "name": "top" } } }` @@ -198,6 +200,7 @@ func testInspectBuildpack(t *testing.T, when spec.G, it spec.S) { BuildpackInfo: dist.BuildpackInfo{ ID: "some/top-buildpack", Version: "0.0.1", + Name: "top", Homepage: "top-buildpack-homepage", }, Stacks: []dist.Stack{ @@ -224,6 +227,7 @@ func testInspectBuildpack(t *testing.T, when spec.G, it spec.S) { { ID: "some/top-buildpack", Version: "0.0.1", + Name: "top", Homepage: "top-buildpack-homepage", }, }, @@ -234,6 +238,7 @@ func testInspectBuildpack(t *testing.T, when spec.G, it spec.S) { BuildpackInfo: dist.BuildpackInfo{ ID: "some/top-buildpack", Version: "0.0.1", + Name: "top", Homepage: "top-buildpack-homepage", }, Optional: false, @@ -340,6 +345,7 @@ func testInspectBuildpack(t *testing.T, when spec.G, it spec.S) { }, LayerDiffID: "sha256:top-buildpack-diff-id", Homepage: "top-buildpack-homepage", + Name: "top", }, }, }, diff --git a/internal/builder/writer/human_readable.go b/internal/builder/writer/human_readable.go index 81b8bbeba8..8edf515c20 100644 --- a/internal/builder/writer/human_readable.go +++ b/internal/builder/writer/human_readable.go @@ -293,13 +293,13 @@ func buildpacksOutput(buildpacks []dist.BuildpackInfo, builderName string) (stri buildpacksTabWriter = tabwriter.NewWriter(spaceStrippingWriter, writerMinWidth, writerPadChar, buildpacksTabWidth, writerPadChar, writerFlags) ) - _, err := fmt.Fprint(buildpacksTabWriter, " ID\tVERSION\tHOMEPAGE\n") + _, err := fmt.Fprint(buildpacksTabWriter, " ID\tNAME\tVERSION\tHOMEPAGE\n") if err != nil { return "", []string{}, fmt.Errorf("writing to tab writer: %w", err) } for _, b := range buildpacks { - _, err = fmt.Fprintf(buildpacksTabWriter, " %s\t%s\t%s\n", b.ID, b.Version, strs.ValueOrDefault(b.Homepage, "-")) + _, err = fmt.Fprintf(buildpacksTabWriter, " %s\t%s\t%s\t%s\n", b.ID, strs.ValueOrDefault(b.Name, "-"), b.Version, strs.ValueOrDefault(b.Homepage, "-")) if err != nil { return "", []string{}, fmt.Errorf("writing to tab writer: %w", err) } diff --git a/internal/builder/writer/human_readable_test.go b/internal/builder/writer/human_readable_test.go index 0448457016..89930b332b 100644 --- a/internal/builder/writer/human_readable_test.go +++ b/internal/builder/writer/human_readable_test.go @@ -67,12 +67,12 @@ Run Images: second/default Buildpacks: - ID VERSION HOMEPAGE - test.top.nested test.top.nested.version - - test.nested http://geocities.com/top-bp - test.bp.one test.bp.one.version http://geocities.com/cool-bp - test.bp.two test.bp.two.version - - test.bp.three test.bp.three.version - + ID NAME VERSION HOMEPAGE + test.top.nested - test.top.nested.version - + test.nested - http://geocities.com/top-bp + test.bp.one - test.bp.one.version http://geocities.com/cool-bp + test.bp.two - test.bp.two.version - + test.bp.three - test.bp.three.version - Detection Order: ├ Group #1: @@ -120,12 +120,12 @@ Run Images: second/local-default Buildpacks: - ID VERSION HOMEPAGE - test.top.nested test.top.nested.version - - test.nested http://geocities.com/top-bp - test.bp.one test.bp.one.version http://geocities.com/cool-bp - test.bp.two test.bp.two.version - - test.bp.three test.bp.three.version - + ID NAME VERSION HOMEPAGE + test.top.nested - test.top.nested.version - + test.nested - http://geocities.com/top-bp + test.bp.one - test.bp.one.version http://geocities.com/cool-bp + test.bp.two - test.bp.two.version - + test.bp.three - test.bp.three.version - Detection Order: ├ Group #1: diff --git a/internal/buildpackage/builder_test.go b/internal/buildpackage/builder_test.go index 7fa1578cda..71cec12e12 100644 --- a/internal/buildpackage/builder_test.go +++ b/internal/buildpackage/builder_test.go @@ -418,6 +418,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { Info: dist.BuildpackInfo{ ID: "bp.1.id", Version: "bp.1.version", + Name: "One", Description: "some description", Homepage: "https://example.com/homepage", Keywords: []string{"some-keyword"}, @@ -453,6 +454,7 @@ func testPackageBuilder(t *testing.T, when spec.G, it spec.S) { h.AssertEq(t, md.Stacks[1].ID, "stack.id.2") h.AssertEq(t, md.Keywords[0], "some-keyword") h.AssertEq(t, md.Homepage, "https://example.com/homepage") + h.AssertEq(t, md.Name, "One") h.AssertEq(t, md.Description, "some description") h.AssertEq(t, md.Licenses[0].Type, "MIT") h.AssertEq(t, md.Licenses[0].URI, "https://example.com/license") diff --git a/internal/commands/buildpack_inspect_test.go b/internal/commands/buildpack_inspect_test.go index eceaabf914..b8cb6b5f78 100644 --- a/internal/commands/buildpack_inspect_test.go +++ b/internal/commands/buildpack_inspect_test.go @@ -37,11 +37,11 @@ const complexOutputSection = `Stacks: (omitted) Buildpacks: - ID VERSION HOMEPAGE - some/first-inner-buildpack 1.0.0 first-inner-buildpack-homepage - some/second-inner-buildpack 2.0.0 second-inner-buildpack-homepage - some/third-inner-buildpack 3.0.0 third-inner-buildpack-homepage - some/top-buildpack 0.0.1 top-buildpack-homepage + ID NAME VERSION HOMEPAGE + some/first-inner-buildpack - 1.0.0 first-inner-buildpack-homepage + some/second-inner-buildpack - 2.0.0 second-inner-buildpack-homepage + some/third-inner-buildpack - 3.0.0 third-inner-buildpack-homepage + some/top-buildpack top 0.0.1 top-buildpack-homepage Detection Order: └ Group #1: @@ -71,9 +71,9 @@ const simpleOutputSection = `Stacks: (omitted) Buildpacks: - ID VERSION HOMEPAGE - some/single-buildpack 0.0.1 single-buildpack-homepage - some/buildpack-no-homepage 0.0.2 - + ID NAME VERSION HOMEPAGE + some/single-buildpack some 0.0.1 single-buildpack-homepage + some/buildpack-no-homepage - 0.0.2 - Detection Order: └ Group #1: @@ -147,6 +147,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/top-buildpack", Version: "0.0.1", Homepage: "top-buildpack-homepage", + Name: "top", }, Stacks: []dist.Stack{ {ID: "io.buildpacks.stacks.first-stack", Mixins: []string{"mixin1", "mixin2", "build:mixin3", "build:mixin4"}}, @@ -173,6 +174,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/top-buildpack", Version: "0.0.1", Homepage: "top-buildpack-homepage", + Name: "top", }, }, Order: dist.Order{ @@ -183,6 +185,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/top-buildpack", Version: "0.0.1", Homepage: "top-buildpack-homepage", + Name: "top", }, Optional: false, }, @@ -290,6 +293,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { }, LayerDiffID: "sha256:top-buildpack-diff-id", Homepage: "top-buildpack-homepage", + Name: "top", }, }, }, @@ -301,6 +305,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/single-buildpack", Version: "0.0.1", Homepage: "single-homepage-homepace", + Name: "some", }, Stacks: []dist.Stack{ {ID: "io.buildpacks.stacks.first-stack", Mixins: []string{"mixin1", "mixin2", "build:mixin3", "build:mixin4"}}, @@ -311,6 +316,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { { ID: "some/single-buildpack", Version: "0.0.1", + Name: "some", Homepage: "single-buildpack-homepage", }, { @@ -342,6 +348,7 @@ func testBuildpackInspectCommand(t *testing.T, when spec.G, it spec.S) { }, LayerDiffID: "sha256:single-buildpack-diff-id", Homepage: "single-buildpack-homepage", + Name: "some", }, }, }, diff --git a/internal/commands/inspect_buildpack.go b/internal/commands/inspect_buildpack.go index 98ea129cbf..f46a309652 100644 --- a/internal/commands/inspect_buildpack.go +++ b/internal/commands/inspect_buildpack.go @@ -177,12 +177,12 @@ func buildpacksOutput(bps []dist.BuildpackInfo) (string, error) { buf := &bytes.Buffer{} tabWriter := new(tabwriter.Writer).Init(buf, writerMinWidth, writerPadChar, buildpacksTabWidth, writerPadChar, writerFlags) - if _, err := fmt.Fprint(tabWriter, " ID\tVERSION\tHOMEPAGE\n"); err != nil { + if _, err := fmt.Fprint(tabWriter, " ID\tNAME\tVERSION\tHOMEPAGE\n"); err != nil { return "", err } for _, bp := range bps { - if _, err := fmt.Fprintf(tabWriter, " %s\t%s\t%s\n", bp.ID, bp.Version, strs.ValueOrDefault(bp.Homepage, "-")); err != nil { + if _, err := fmt.Fprintf(tabWriter, " %s\t%s\t%s\t%s\n", bp.ID, strs.ValueOrDefault(bp.Name, "-"), bp.Version, strs.ValueOrDefault(bp.Homepage, "-")); err != nil { return "", err } } diff --git a/internal/commands/inspect_buildpack_test.go b/internal/commands/inspect_buildpack_test.go index 0808e7f7c0..34d5722807 100644 --- a/internal/commands/inspect_buildpack_test.go +++ b/internal/commands/inspect_buildpack_test.go @@ -93,6 +93,7 @@ func testInspectBuildpackCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/top-buildpack", Version: "0.0.1", Homepage: "top-buildpack-homepage", + Name: "top", }, }, Order: dist.Order{ @@ -232,6 +233,7 @@ func testInspectBuildpackCommand(t *testing.T, when spec.G, it spec.S) { ID: "some/single-buildpack", Version: "0.0.1", Homepage: "single-buildpack-homepage", + Name: "some", }, { ID: "some/buildpack-no-homepage", diff --git a/internal/dist/buildpack.go b/internal/dist/buildpack.go index 2244a9edde..a6f25b4cf6 100644 --- a/internal/dist/buildpack.go +++ b/internal/dist/buildpack.go @@ -41,6 +41,7 @@ type Buildpack interface { type BuildpackInfo struct { ID string `toml:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty"` + Name string `toml:"name,omitempty" json:"name,omitempty" yaml:"name,omitempty"` Version string `toml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"` Description string `toml:"description,omitempty" json:"description,omitempty" yaml:"description,omitempty"` Homepage string `toml:"homepage,omitempty" json:"homepage,omitempty" yaml:"homepage,omitempty"` diff --git a/internal/dist/dist.go b/internal/dist/dist.go index 0965148ce8..4a09277a27 100644 --- a/internal/dist/dist.go +++ b/internal/dist/dist.go @@ -50,6 +50,7 @@ type BuildpackLayerInfo struct { Order Order `json:"order,omitempty"` LayerDiffID string `json:"layerDiffID"` Homepage string `json:"homepage,omitempty"` + Name string `json:"name,omitempty"` } func (b BuildpackLayers) Get(id, version string) (BuildpackLayerInfo, bool) { @@ -78,5 +79,6 @@ func AddBuildpackToLayersMD(layerMD BuildpackLayers, descriptor BuildpackDescrip Order: descriptor.Order, LayerDiffID: diffID, Homepage: bpInfo.Homepage, + Name: bpInfo.Name, } }