buildpacks / samples

Samples for Cloud Native Buildpacks
Apache License 2.0
194 stars 145 forks source link

Extension samples don't work as described in tutorial #161

Closed jihuin closed 8 months ago

jihuin commented 1 year ago

Problem

Extension samples didn't work as described in tutorial: https://buildpacks.io/docs/extension-guide/create-extension/why-dockerfiles/

Issue 1: Buildpack API incompatibility when creating the builder

I followed the tutorial to set up the local env and create the builder. Got the error of Buildpack API incompatibility:

$ pack builder create localhost:5000/extensions-builder \
  --config $PWD/samples/builders/alpine/builder.toml \
  --publish
Downloading from https://github.com/buildpacks/lifecycle/releases/download/v0.15.2/lifecycle-v0.15.2+linux.x86-64.tgz
9.76 MB/9.76 MB
ERROR: validating extensions: extension samples/cowsay@0.0.1 (Buildpack API 0.10) is incompatible with lifecycle 0.15.2 (Buildpack API(s) 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)

I added the following snippet to "$PWD/samples/builders/alpine/builder.toml" as a fix:

[lifecycle]
version = "0.17.0-rc.3"

Issue 2: hello-extensions buildpack didn't pass the detection

Command:

pack build hello-extensions \
  --builder localhost:5000/extensions-builder \
  --network host \
  --path $PWD/samples/apps/java-maven \
  --pull-policy always \
  --verbose

The expected behavior is that hello-extensions buildpack passes the detection but failes the build. The result I got was the detection failed.

Output:

[detector] ======== Results ========
[detector] pass: samples/vim@0.0.1
[detector] pass: samples/curl@0.0.1
[detector] pass: samples/cowsay@0.0.1
[detector] fail: samples/hello-extensions@0.0.1
[detector] ======== Results ========
[detector] fail: samples/hello-extensions@0.0.1
[detector] ======== Results ========
[detector] pass: samples/vim@0.0.1
[detector] pass: samples/curl@0.0.1
[detector] pass: samples/cowsay@0.0.1
[detector] pass: samples/java-maven@0.0.1
[detector] Resolving plan... (try #1)
[detector] skip: samples/cowsay@0.0.1 provides unused cowsay
[detector] skip: samples/vim@0.0.1 provides unused vim
[detector] skip: samples/curl@0.0.1 provides unused curl
[detector] 1 of 4 buildpacks participating
[detector] samples/java-maven 0.0.1

Environment

natalieparellano commented 1 year ago

Thank you @jihuin and apologies, we need to update the tutorial with the latest version of samples. A fix will be coming soon

AidanDelaney commented 8 months ago

We had a bunch of work to do to fix this. We had to update the samples to a later buildpack API and update pack itself (first to a pre-release, then ...). But it should be fixed. Though we're aware of #170 still.