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

UX: Call out ordering of buildpacks when failing detection #1366

Open
schneems opened this issue Jun 17, 2024 · 2 comments
Open

UX: Call out ordering of buildpacks when failing detection #1366

schneems opened this issue Jun 17, 2024 · 2 comments
Labels
good first issue A good first issue to get started with. help wanted Need some extra hands to the this done. status/ready type/bug Something isn't working

Comments

@schneems
Copy link

Summary

The build plan output when passing it two buildpacks does not make it clear that order can be a problem


Reproduction

Steps
$ mkdir -p /tmp/f24a08bca473d7a34ed391f4b8c76d12; cd /tmp/f24a08bca473d7a34ed391f4b8c76d12
$ git clone https://github.com/heroku/ruby-getting-started
$ git clone https://github.com/heroku/buildpacks-ruby
$ cd buildpacks-ruby
$ git checkout aaa72f317ee7b4700de35ea27112c1ad15334def

Follow steps to install https://github.com/heroku/buildpacks-ruby/blob/aaa72f317ee7b4700de35ea27112c1ad15334def/CONTRIBUTING.md#development

$ cargo libcnb package
# ...
$ pack build mon-jun-17 --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path /tmp/f24a08bca473d7a34ed391f4b8c76d12/ruby-getting-started --builder heroku/builder:24 --buildpack heroku/nodejs-engine
Current behavior

When I run that command, I get a failure

$ pack build mon-jun-17 --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path /tmp/f24a08bca473d7a34ed391f4b8c76d12/ruby-getting-started --builder heroku/builder:24 --buildpack heroku/nodejs-engine
24: Pulling from heroku/builder
Digest: sha256:ebbea500fc0f86924edac9f3bf6cb48426308ea2f8413bd25a12bc40db46c57e
Status: Image is up to date for heroku/builder:24
24: Pulling from heroku/heroku
Digest: sha256:09851f0d8c298913aa8e441c9139d5645d281b120525379430013317bcc253db
Status: Image is up to date for heroku/heroku:24
===> ANALYZING
Image with name "mon-jun-17" not found
===> DETECTING
======== Results ========
pass: heroku/[email protected]
pass: heroku/[email protected]
Resolving plan... (try buildpacks/pack#1)
fail: heroku/[email protected] requires node
Resolving plan... (try buildpacks/pack#2)
fail: heroku/[email protected] requires node
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 20

Which, was odd because heroku/nodejs-engine provides node and you can see from the output that it passes detection.

The issue turned out to be the order of the buildpacks was incorrect, it should have been using Node first:

$ pack build mon-jun-17 --path /tmp/f24a08bca473d7a34ed391f4b8c76d12/ruby-getting-started --builder heroku/builder:24 --buildpack heroku/nodejs-engine --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby/
Expected behavior

I expect that minor mistakes in a build plan (from package.toml or passed in via CLI) are highlighted by the failure output. Ideally I would get a message like:

The heroku/ruby@<version>` buildpack depends on "node" which is provided by `heroku/nodejs@<version>`, however `heroku/nodejs@<version>` will not execute until after `heroku/ruby@<version>`. Consider re-ordering which buildpack comes first.

Environment

pack info
$ pack report
Pack:
  Version:  0.34.2+git-ce8db3c.build-6005
  OS/Arch:  darwin/arm64

Default Lifecycle Version:  0.19.6

Supported Platform APIs:  0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13

Config:
  default-builder-image = "[REDACTED]"
docker info
$ docker info
Client:
 Version:    26.1.1
 Context:    desktop-linux
# ...
@schneems schneems added status/triage type/bug Something isn't working labels Jun 17, 2024
@natalieparellano
Copy link
Member

We should probably move this issue over to the lifecycle. It might be hard to give such a detailed error message, but we could append something like "check the provided order to ensure that buildpacks providing dependencies run before the buildpacks that require them"

@jjbustamante jjbustamante transferred this issue from buildpacks/pack Jun 19, 2024
@jjbustamante
Copy link
Member

Yes, I was thinking about how to get such detailed information without doing a lot of work, but I am not sure if it is possible. I like the idea, but the implementation is not straight forward

@natalieparellano natalieparellano added status/ready good first issue A good first issue to get started with. help wanted Need some extra hands to the this done. and removed status/triage labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good first issue to get started with. help wanted Need some extra hands to the this done. status/ready type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants