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

Add buildpack homepages to inspect-image output #1092

Merged
merged 5 commits into from
Mar 9, 2021

Conversation

aemengo
Copy link
Contributor

@aemengo aemengo commented Feb 24, 2021

Summary

Add buildpack homepages to inspect-image output

Output

Before

Buildpacks:
  ID                                         VERSION
  paketo-buildpacks/ca-certificates          1.0.1
  paketo-buildpacks/bellsoft-liberica        6.1.0
  paketo-buildpacks/executable-jar           3.1.3
  paketo-buildpacks/spring-boot              3.5.0

After

Buildpacks:
  ID                                                  VERSION        HOMEPAGE
  paketo-buildpacks/ca-certificates                   1.0.1          https://github.com/paketo-buildpacks/ca-certificates
  paketo-buildpacks/bellsoft-liberica                 6.1.0          https://github.com/paketo-buildpacks/bellsoft-liberica
  paketo-buildpacks/executable-jar                    3.1.3          https://github.com/paketo-buildpacks/executable-jar
  paketo-buildpacks/spring-boot                       3.5.0          https://github.com/paketo-buildpacks/spring-boot

Documentation

Related

Resolves #1033

@github-actions github-actions bot added type/chore Issue that requests non-user facing changes. type/enhancement Issue that requests a new feature or improvement. labels Feb 24, 2021
@github-actions github-actions bot added this to the 0.18.0 milestone Feb 24, 2021
@aemengo aemengo force-pushed the add-homepages-to-inspect-image branch from eb6421d to 6deca7b Compare February 25, 2021 20:53
@aemengo
Copy link
Contributor Author

aemengo commented Feb 26, 2021

When someone doesn't provide a buildpack, such as iterating on a custom buildpack - the output looks a little awkward.

Buildpacks:
  ID                               VERSION        HOMEPAGE
  anthony/custom                   1.0.1          

What do we think of adding a - to indicate an omission?

Buildpacks:
  ID                               VERSION        HOMEPAGE
  anthony/custom                   1.0.1          -

@aemengo aemengo marked this pull request as ready for review February 26, 2021 18:19
@aemengo aemengo requested a review from a team as a code owner February 26, 2021 18:19
@dwillist
Copy link
Contributor

dwillist commented Mar 1, 2021

Acceptance

Just going to include json and human readable output here for brevity.

This output was gathered by building this application with the following

Setup

the nodejs/yarn sample app from the paketo-buildpacks samples

This node-engine buildpack (it has the homepage omitted)
buildpack.tar.gz

Image build command:

pack build custom-nodejs-sample -p samples/nodejs/yarn --buildpack ~/workspace/VMware/paketo-buildpacks/node-engine/build/buildpack.tgz --buildpack paketobuildpacks/yarn:0.1.2 --buildpack paketobuildpacks/yarn-install:0.2.3 --buildpack paketobuildpacks/yarn-start:0.0.4

Testing:

Human Readable

Command

pack inspect-image custom-nodejs-sample

Output

Inspecting image: custom-nodejs-sample

REMOTE:
(not present)

LOCAL:

Stack: io.buildpacks.stacks.bionic

Base Image:
  Reference: 883faa600da37641e47618dc1bbbdeaf9900114e43bef808a233109a2d0d6b7d
  Top Layer: sha256:16b4b083253b07f16420f4df9d60fe8e08be237fc9557c343172911de5e08b5c

Run Images:
  index.docker.io/paketobuildpacks/run:base-cnb
  gcr.io/paketo-buildpacks/run:base-cnb

Buildpacks:
  ID                                    VERSION        HOMEPAGE
  paketo-buildpacks/node-engine         1.2.3
  paketo-buildpacks/yarn                0.1.2          https://github.com/paketo-buildpacks/yarn
  paketo-buildpacks/yarn-install        0.2.3          https://github.com/paketo-buildpacks/yarn-install
  paketo-buildpacks/yarn-start          0.0.4          https://github.com/paketo-buildpacks/yarn-start

Processes:
  TYPE                 SHELL        COMMAND        ARGS
  web (default)        bash         node server.js

JSON

Command

pack inspect-image custom-nodejs-sample --output json

Output:

{
  "image_name": "custom-nodejs-sample",
  "remote_info": null,
  "local_info": {
    "stack": "io.buildpacks.stacks.bionic",
    "base_image": {
      "top_layer": "sha256:16b4b083253b07f16420f4df9d60fe8e08be237fc9557c343172911de5e08b5c",
      "reference": "883faa600da37641e47618dc1bbbdeaf9900114e43bef808a233109a2d0d6b7d"
    },
    "run_images": [
      {
        "name": "index.docker.io/paketobuildpacks/run:base-cnb"
      },
      {
        "name": "gcr.io/paketo-buildpacks/run:base-cnb"
      }
    ],
    "buildpacks": [
      {
        "id": "paketo-buildpacks/node-engine",
        "version": "1.2.3"
      },
      {
        "id": "paketo-buildpacks/yarn",
        "version": "0.1.2",
        "homepage": "https://github.com/paketo-buildpacks/yarn"
      },
      {
        "id": "paketo-buildpacks/yarn-install",
        "version": "0.2.3",
        "homepage": "https://github.com/paketo-buildpacks/yarn-install"
      },
      {
        "id": "paketo-buildpacks/yarn-start",
        "version": "0.0.4",
        "homepage": "https://github.com/paketo-buildpacks/yarn-start"
      }
    ],
    "processes": [
      {
        "type": "web",
        "shell": "bash",
        "command": "node server.js",
        "default": true,
        "args": null
      }
    ]
  }
}

Conclusion

This all looks 💯 , only question is if we want to use - for omitted Homepage fields in the Human Readable section. If not this is perfect.

The bom additions don't look like they are possible right now, see the above comment

@aemengo
Copy link
Contributor Author

aemengo commented Mar 1, 2021

Let's add the -, but only for human-readable format. Please wait for it.
I just wanted the co-sign from a venerated Platform Maintainer

@jromero
Copy link
Member

jromero commented Mar 1, 2021

Let's add the -, but only for human-readable format. Please wait for it.
I just wanted the co-sign from a venerated Platform Maintainer

If we add it to this command, do you mind adding it to inspect-builder and inspect-buildpack as well for consistency.

@aemengo aemengo force-pushed the add-homepages-to-inspect-image branch from 00aec1c to c92675f Compare March 2, 2021 22:58
@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #1092 (fc74b7a) into main (efc6749) will decrease coverage by 0.51%.
The diff coverage is 91.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1092      +/-   ##
==========================================
- Coverage   80.51%   80.00%   -0.50%     
==========================================
  Files         135      136       +1     
  Lines        8221     5993    -2228     
==========================================
- Hits         6618     4794    -1824     
+ Misses       1174      766     -408     
- Partials      429      433       +4     
Flag Coverage Δ
os_linux 79.96% <91.67%> (-0.01%) ⬇️
os_macos 77.51% <91.67%> (+0.06%) ⬆️
os_windows 100.00% <ø> (+19.59%) ⬆️
unit 80.00% <91.67%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@aemengo
Copy link
Contributor Author

aemengo commented Mar 2, 2021

If we add it to this command, do you mind adding it to inspect-builder and inspect-buildpack as well for consistency.

Pushed a new commit with these changes.

@dwillist
Copy link
Contributor

dwillist commented Mar 3, 2021

Acceptance 2.0

Double checking the human readable output chagnes:

Image artifact:

Setup

This was built using the same setup and pack build ... command as above

Output

Inspecting image: custom-nodejs-sample

REMOTE:
(not present)

LOCAL:

Stack: io.buildpacks.stacks.bionic

Base Image:
  Reference: 883faa600da37641e47618dc1bbbdeaf9900114e43bef808a233109a2d0d6b7d
  Top Layer: sha256:16b4b083253b07f16420f4df9d60fe8e08be237fc9557c343172911de5e08b5c

Run Images:
  index.docker.io/paketobuildpacks/run:base-cnb
  gcr.io/paketo-buildpacks/run:base-cnb

Buildpacks:
  ID                                    VERSION        HOMEPAGE
  paketo-buildpacks/node-engine         1.2.3          -
  paketo-buildpacks/yarn                0.1.2          https://github.com/paketo-buildpacks/yarn
  paketo-buildpacks/yarn-install        0.2.3          https://github.com/paketo-buildpacks/yarn-install
  paketo-buildpacks/yarn-start          0.0.4          https://github.com/paketo-buildpacks/yarn-start

Processes:
  TYPE                 SHELL        COMMAND        ARGS
  web (default)        bash         node server.js

Builder

Setup

This builder was setup using the buildpack.tar.gz linked in the first round of acceptance testing and the following builder.toml file:

description = "Ubuntu bionic base image with buildpacks for Java, .NET Core, NodeJS, Go, Ruby, NGINX and Procfile"

[[buildpacks]]
  uri = "/Users/dthornton/Downloads/buildpack.tar.gz"
  version = "1.2.3"

[[buildpacks]]
  image = "paketobuildpacks/yarn:0.1.2" 

[[buildpacks]]
  image = "paketobuildpacks/yarn-install"
[[buildpacks]]
  image = "paketobuildpacks/yarn-start"

[lifecycle]
  version = "0.10.2"

[[order]]

  [[order.group]]
    id = "paketo-buildpacks/node-engine"
    version = "1.2.3"

  [[order.group]]
    id = "paketo-buildpacks/yarn"
    version = "0.1.2"

  [[order.group]]
    id = "paketo-buildpacks/yarn-install"
    version = "0.2.3"

  [[order.group]]
    id = "paketo-buildpacks/yarn-start"
    version = "0.0.4"

[stack]
  build-image = "docker.io/paketobuildpacks/build:1.0.22-base-cnb"
  id = "io.buildpacks.stacks.bionic"
  run-image = "index.docker.io/paketobuildpacks/run:base-cnb"
  run-image-mirrors = ["gcr.io/paketo-buildpacks/run:base-cnb"]

####Output

Inspecting builder: boss-builder

REMOTE:
(not present)

LOCAL:

Description: Ubuntu bionic base image with buildpacks for Java, .NET Core, NodeJS, Go, Ruby, NGINX and Procfile

Created By:
  Name: Pack CLI
  Version: 0.17.0+git-d9cb4e7.build-2045

Trusted: No

Stack:
  ID: io.buildpacks.stacks.bionic

Lifecycle:
  Version: 0.10.2
  Buildpack APIs:
    Deprecated: (none)
    Supported: 0.2, 0.3, 0.4, 0.5
  Platform APIs:
    Deprecated: (none)
    Supported: 0.3, 0.4, 0.5

Run Images:
  index.docker.io/paketobuildpacks/run:base-cnb
  gcr.io/paketo-buildpacks/run:base-cnb

Buildpacks:
  ID                                    VERSION        HOMEPAGE
  paketo-buildpacks/node-engine         1.2.3          -
  paketo-buildpacks/yarn                0.1.2          https://github.com/paketo-buildpacks/yarn
  paketo-buildpacks/yarn-install        0.2.3          https://github.com/paketo-buildpacks/yarn-install
  paketo-buildpacks/yarn-start          0.0.4          https://github.com/paketo-buildpacks/yarn-start

Detection Order:
 └ Group #1:
    ├ paketo-buildpacks/node-engine@1.2.3
    ├ paketo-buildpacks/yarn@0.1.2
    ├ paketo-buildpacks/yarn-install@0.2.3
    └ paketo-buildpacks/yarn-start@0.0.4

Buildpack

Setup

using the buildpack.tar.gz posted in the first round of acceptance and the following package.toml file to create a buildpackage

package.toml
[buildpack]
uri = "/path/to/buildpack.tar.gz"

Output

running pack inpsect-buildpack <output-buildpack>

Inspecting buildpack: boss-buildpack

LOCAL IMAGE:

Stacks:
  ID: io.buildpacks.stacks.bionic
    Mixins:
      (omitted)
  ID: org.cloudfoundry.stacks.cflinuxfs3
    Mixins:
      (omitted)

Buildpacks:
  ID                                   VERSION        HOMEPAGE
  paketo-buildpacks/node-engine        1.2.3          -

Detection Order:
 └ Group #1:
    └ paketo-buildpacks/node-engine@1.2.3

Conclusion:

Looks perfect to me 👍

Copy link
Member

@dfreilich dfreilich left a comment

Choose a reason for hiding this comment

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

Overall, this looks really good! I'm just not sure about dashOrValue as it currently is. Also, looks like it needs a very small merge to one of the fixtures. Happy to see this added!

internal/builder/writer/human_readable.go Outdated Show resolved Hide resolved
Anthony Emengo added 3 commits March 5, 2021 11:54
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
* This functionality cannot be observed

Signed-off-by: Anthony Emengo <aemengo@vmware.com>
@aemengo aemengo force-pushed the add-homepages-to-inspect-image branch from c92675f to cfa1d3a Compare March 5, 2021 17:29
Anthony Emengo and others added 2 commits March 5, 2021 14:13
* Implement strings.ValueOrDefault()

Signed-off-by: Anthony Emengo <aemengo@vmware.com>
@jromero jromero removed the type/chore Issue that requests non-user facing changes. label Mar 9, 2021
@jromero jromero merged commit 6d538b8 into buildpacks:main Mar 9, 2021
@aemengo aemengo deleted the add-homepages-to-inspect-image branch March 9, 2021 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add buildpack homepages to inspect-image output
4 participants