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

pack buildpack inspect now works when no docker daemon is available #1104

Merged
merged 3 commits into from
Mar 10, 2021

Conversation

dwillist
Copy link
Contributor

@dwillist dwillist commented Mar 8, 2021

Signed-off-by: dwillist dthornton@vmware.com

Summary

Resolves a bug around inspecting buildpacks when no docker daemon is running.

Previously this just returned an error indicating the docker daemon was not running.
Now it returns the result of the remote inspection.

PS.
There is some work to do around standardizing these inspection commands. Seems like we should not show errors unless users explicitly ask for them.

Related

Resolves #1095

@dwillist dwillist requested a review from a team as a code owner March 8, 2021 19:59
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Mar 8, 2021
@github-actions github-actions bot added this to the 0.18.0 milestone Mar 8, 2021
Signed-off-by: dwillist <dthornton@vmware.com>
@dwillist dwillist force-pushed the inspect-buildpack-no-daemon-fix branch from a12b488 to 05750dc Compare March 8, 2021 20:12
@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #1104 (66bcc3e) into main (838af1a) will decrease coverage by 0.53%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1104      +/-   ##
==========================================
- Coverage   80.53%   80.00%   -0.52%     
==========================================
  Files         136      136              
  Lines        8229     5994    -2235     
==========================================
- Hits         6626     4795    -1831     
+ Misses       1174      766     -408     
- Partials      429      433       +4     
Flag Coverage Δ
os_linux 80.00% <100.00%> (+0.06%) ⬆️
os_macos 77.52% <100.00%> (+0.06%) ⬆️
os_windows 100.00% <ø> (+19.57%) ⬆️
unit 80.00% <100.00%> (+0.06%) ⬆️

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

Copy link
Member

@jromero jromero left a comment

Choose a reason for hiding this comment

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

✅ Accepted

⚠️ Minor feedback:

  • The json key localError looks inconsistent.
    • We normally use snake_case. See pack inspect-image -o json
❯ pack inspect-image buildpacksio/pack:latest --bom
ERROR: unable to find image 'buildpacksio/pack:latest' locally or remotely

❯ pack-dev inspect-image buildpacksio/pack:latest --bom
{
  "remote": [
    {
      "name": "go",
      "metadata": {
        "licenses": [],
        "name": "Go",
        "sha256": "2b6ff1d4025212d18db2c238cc6381b46c8da0e01de95705343ae529edb28e90",
        "stacks": [
          "io.buildpacks.stacks.bionic",
          "io.paketo.stacks.tiny",
          "org.cloudfoundry.stacks.cflinuxfs3"
        ],
        "uri": "https://buildpacks.cloudfoundry.org/dependencies/go/go_1.14.14_linux_x64_cflinuxfs3_2b6ff1d4.tgz",
        "version": "1.14.14"
      },
      "buildpacks": {
        "id": "paketo-buildpacks/go-dist",
        "version": "0.2.8"
      }
    }
  ],
  "local": null,
  "localError": "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
}

Signed-off-by: dwillist <dthornton@vmware.com>
Copy link
Member

@jromero jromero left a comment

Choose a reason for hiding this comment

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

✅ Accepted

# DOCKER DAEMON SHUTOFF

❯ pack-dev inspect-image buildpacksio/pack:latest --bom
{
  "remote": [
    {
      "name": "go",
      "metadata": {
        "licenses": [],
        "name": "Go",
        "sha256": "2b6ff1d4025212d18db2c238cc6381b46c8da0e01de95705343ae529edb28e90",
        "stacks": [
          "io.buildpacks.stacks.bionic",
          "io.paketo.stacks.tiny",
          "org.cloudfoundry.stacks.cflinuxfs3"
        ],
        "uri": "https://buildpacks.cloudfoundry.org/dependencies/go/go_1.14.14_linux_x64_cflinuxfs3_2b6ff1d4.tgz",
        "version": "1.14.14"
      },
      "buildpacks": {
        "id": "paketo-buildpacks/go-dist",
        "version": "0.2.8"
      }
    }
  ],
  "local": null,
  "local_error": "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
}

❯ pack-dev inspect-buildpack paketobuildpacks/node-engine:0.1.6
Inspecting buildpack: paketobuildpacks/node-engine:0.1.6

REMOTE IMAGE:

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

Buildpacks:
  ID                                   VERSION        HOMEPAGE
  paketo-buildpacks/node-engine        0.1.6          https://github.com/paketo-buildpacks/node-engine

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

# DOCKER DAEMON STARTED

❯ pack-dev inspect-buildpack paketobuildpacks/node-engine:0.1.6
Inspecting buildpack: paketobuildpacks/node-engine:0.1.6

REMOTE IMAGE:

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

Buildpacks:
  ID                                   VERSION        HOMEPAGE
  paketo-buildpacks/node-engine        0.1.6          https://github.com/paketo-buildpacks/node-engine

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

❯ docker pull paketobuildpacks/node-engine:0.1.6
0.1.6: Pulling from paketobuildpacks/node-engine
8e25f377e7a0: Pull complete
Digest: sha256:93d162aad91dd2a358cd85b63c40006c166973dd90428cd06995d0898c98b61b
Status: Downloaded newer image for paketobuildpacks/node-engine:0.1.6
docker.io/paketobuildpacks/node-engine:0.1.6


❯ pack-dev inspect-buildpack paketobuildpacks/node-engine:0.1.6
Inspecting buildpack: paketobuildpacks/node-engine:0.1.6

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        0.1.6          https://github.com/paketo-buildpacks/node-engine

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

REMOTE IMAGE:

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

Buildpacks:
  ID                                   VERSION        HOMEPAGE
  paketo-buildpacks/node-engine        0.1.6          https://github.com/paketo-buildpacks/node-engine

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

perfect

EDIT: Added pack inspect-buildpack user acceptance tests

@jromero jromero added type/bug Issue that reports an unexpected behaviour. and removed type/enhancement Issue that requests a new feature or improvement. labels Mar 10, 2021
@jromero jromero changed the title update inspect buildpack to work with no daemon pack buildpack inspect now works when no docker daemon is available Mar 10, 2021
@jromero jromero merged commit e7ce8fc into main Mar 10, 2021
@jromero jromero deleted the inspect-buildpack-no-daemon-fix branch March 10, 2021 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Issue that reports an unexpected behaviour.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot inspect image for BOM when docker daemon is not running
3 participants