buildpacks / pack

CLI for building apps using Cloud Native Buildpacks
https://buildpacks.io
Apache License 2.0
2.54k stars 286 forks source link

UX bug, warn when using the image name the same as a local directory #2231

Open schneems opened 1 month ago

schneems commented 1 month ago

Summary

If you run this:

$ pack build ./ruby-getting-started

It will try to build an image named "./ruby-getting-started" instead of building an image with the contents of the directory in ./ruby-getting-started

Reproduction

Steps
$ git clone https://github.com/heroku/ruby-getting-started
$ pack config default-builder heroku/builder:24
$ pack build ./ruby-getting-started
Current behavior
$ pack build ./ruby-getting-started
24: Pulling from heroku/builder
c3c95e61d135: Already exists
51d8f1b9713f: Pull complete
5a2ba7ce94a1: Pull complete
182afb1fe5dc: Pull complete
a6d1c250c7ea: Pull complete
871d0c542f96: Pull complete
bb2d5bbfa209: Pull complete
1a22f95c2361: Pull complete
35c3a9574722: Pull complete
99677fb6a9c6: Pull complete
cc63f855e080: Pull complete
81491acfe764: Pull complete
113fe7e3e540: Pull complete
9822e4b97eba: Pull complete
ba2d82eef5c3: Pull complete
f48aa984467d: Pull complete
ffaf58b86fd8: Pull complete
6343107da9e3: Pull complete
a4fea99767cd: Pull complete
f63217451a36: Pull complete
15ee3b84c724: Pull complete
3a4558bbdea5: Pull complete
08b352b17a85: Pull complete
4fb627380bfa: Pull complete
962feb4a90d7: Pull complete
183b762aa2b7: Pull complete
0814ee8e7dab: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:96bc5b2df323bdd8349fae20bc716c6c471ea6cdaad361ad2d7941bd2f10557f
Status: Downloaded newer image for heroku/builder:24
24: Pulling from heroku/heroku
eed1663d2238: Already exists
51d8f1b9713f: Already exists
Digest: sha256:36e92b6b4e2a980a02363b9f1ddce582c32f38e236b778a6570dedf3d52ab733
Status: Downloaded newer image for heroku/heroku:24
===> ANALYZING
Image with name "./ruby-getting-started" not found
===> DETECTING
======== Output: heroku/python@0.12.1 ========
No Python project files found (such as requirements.txt).
======== Results ========
fail: heroku/python@0.12.1
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/nodejs-engine@3.2.8
skip: heroku/nodejs-yarn@3.2.8
pass: heroku/jvm@6.0.1
pass: heroku/ruby@3.0.0
skip: heroku/procfile@3.1.2
Resolving plan... (try #1)
fail: heroku/nodejs-engine@3.2.8 provides unused node
Resolving plan... (try #2)
skip: heroku/nodejs-engine@3.2.8 provides unused node
skip: heroku/jvm@6.0.1 provides unused jdk
fail: heroku/ruby@3.0.0 provides unused ruby
======== Results ========
pass: heroku/nodejs-engine@3.2.8
fail: heroku/nodejs-corepack@3.2.8
fail: heroku/nodejs-pnpm-install@3.2.8
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/nodejs-engine@3.2.8
fail: heroku/nodejs-pnpm-engine@3.2.8
fail: heroku/nodejs-pnpm-install@3.2.8
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/nodejs-engine@3.2.8
skip: heroku/nodejs-corepack@3.2.8
fail: heroku/nodejs-yarn@3.2.8
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/nodejs-engine@3.2.8
skip: heroku/nodejs-corepack@3.2.8
skip: heroku/nodejs-npm-engine@3.2.8
fail: heroku/nodejs-npm-install@3.2.8
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/nodejs-engine@3.2.8
skip: heroku/procfile@3.1.2
Resolving plan... (try #1)
fail: heroku/nodejs-engine@3.2.8 provides unused node
Resolving plan... (try #2)
fail: heroku/nodejs-engine@3.2.8 provides unused node
======== Results ========
pass: heroku/jvm@6.0.1
fail: heroku/maven@6.0.1
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/jvm@6.0.1
fail: heroku/gradle@6.0.1
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/jvm@6.0.1
fail: heroku/sbt@6.0.1
skip: heroku/procfile@3.1.2
======== Results ========
pass: heroku/go@0.4.1
skip: heroku/procfile@3.1.2
Resolving plan... (try #1)
fail: heroku/go@0.4.1 provides unused go
======== Output: heroku/php@0.2.0 ========
No PHP project files found.
======== Results ========
fail: heroku/php@0.2.0
skip: heroku/procfile@3.1.2
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

This is an absolute wall of text

Expected behavior

A warning:

WARNING: You are building an image named `./ruby-getting-started` this is also the name of a directory. Did you mean to run `pack build <args> --path ./ruby-getting-started?

We probably don't need to issue this warning if there's both an explicit image name and a path being used. We should still warn even when only characters are used i.e. no leading ./ or /


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]"
hhiroshell commented 1 month ago

I want to give it a try. Could you please assign this to me?

natalieparellano commented 1 month ago

@hhiroshell sounds good! I'll assign you

hhiroshell commented 2 weeks ago

I'm sorry for the lack of progress for a while. Now that my other work has settled, I have started working on the implementation.