heroku / buildpacks-ruby

Heroku's Cloud Native Buildpack for Ruby applications.
BSD 3-Clause "New" or "Revised" License
25 stars 1 forks source link

Detection fails #117

Closed ipmb closed 12 months ago

ipmb commented 1 year ago

When using this buildpack, detection fails for my app:

$ pack build -b urn:cnb:registry:heroku/ruby -B heroku/buildpacks:20 test
20: Pulling from heroku/buildpacks
Digest: sha256:2fe5886daf7f584cfa4182a67179219990f6ddae3ec1dac8319ab1f716d5c42f
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:49ddea370926985c40d2ad0e0957063937ed32bfbebcad77651d86beaf3d2c47
Status: Image is up to date for heroku/heroku:20-cnb
docker.io/heroku/buildpack-ruby@sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4: Pulling from heroku/buildpack-ruby
Digest: sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4
Status: Image is up to date for heroku/buildpack-ruby@sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4
===> ANALYZING
Previous image with name "test" not found
===> DETECTING
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
$ ls -1
app
app.json
bin
config
config.ru
db
esbuild.config.js
Gemfile
Gemfile.lock
gitpod.Dockerfile
lib
log
MIT-LICENSE
package.json
postcss.config.js
postcss.mailer.config.js
Procfile
Procfile.dev
public
Rakefile
README.md
render.yaml
test
tmp
vendor
yarn.lock

Using the non-CNB heroku/ruby buildpack, detection works as expected:

$ pack build -b heroku/ruby -B heroku/buildpacks:20 test
20: Pulling from heroku/buildpacks
Digest: sha256:2fe5886daf7f584cfa4182a67179219990f6ddae3ec1dac8319ab1f716d5c42f
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:49ddea370926985c40d2ad0e0957063937ed32bfbebcad77651d86beaf3d2c47
Status: Image is up to date for heroku/heroku:20-cnb
===> ANALYZING
Previous image with name "test" not found
===> DETECTING
heroku/ruby 0.0.0
===> RESTORING
===> BUILDING
-----> Installing bundler 2.3.25
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
edmorley commented 1 year ago

Could you run pack build with --verbose, so it shows the reason for detect failing? As is, there is not enough information in that output to be able to debug the failure.

(Once https://github.com/buildpacks/lifecycle/pull/975 is in a released version of pack CLI, the output in the detect-fail case should be more usable by default, thankfully :-) )

ipmb commented 1 year ago
$ pack build -b urn:cnb:registry:heroku/ruby -B heroku/buildpacks:20 --verbose test
Builder heroku/buildpacks:20 is trusted
Pulling image index.docker.io/heroku/buildpacks:20
20: Pulling from heroku/buildpacks
Digest: sha256:2fe5886daf7f584cfa4182a67179219990f6ddae3ec1dac8319ab1f716d5c42f
Status: Image is up to date for heroku/buildpacks:20
Selected run image heroku/heroku:20-cnb
Pulling image heroku/heroku:20-cnb
20-cnb: Pulling from heroku/heroku
Digest: sha256:49ddea370926985c40d2ad0e0957063937ed32bfbebcad77651d86beaf3d2c47
Status: Image is up to date for heroku/heroku:20-cnb
Downloading buildpack from registry: urn:cnb:registry:heroku/ruby
Refreshing registry cache for github.com//buildpacks/registry-index
Validating registry cache for github.com//buildpacks/registry-index
Creating registry cache for github.com//buildpacks/registry-index
Pulling image docker.io/heroku/buildpack-ruby@sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4
docker.io/heroku/buildpack-ruby@sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4: Pulling from heroku/buildpack-ruby
Digest: sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4
Status: Image is up to date for heroku/buildpack-ruby@sha256:7f48a442c056cd19ea48462e05faa2837ac3a13732c47616d20f11f8c847a8c4
Adding buildpack heroku/ruby version 2.0.0 to builder
Setting custom order
Creating builder with the following buildpacks:
-> heroku/java@0.6.6
-> heroku/jvm@1.0.6
-> heroku/maven@1.0.3
-> heroku/procfile@2.0.0
-> heroku/scala@0.0.0
-> heroku/java-function@0.3.40
-> heroku/jvm-function-invoker@0.6.7
-> heroku/maven@1.0.3
-> heroku/jvm@1.0.6
-> heroku/gradle@0.0.0
-> heroku/ruby@0.0.0
-> heroku/procfile@2.0.0
-> heroku/python@0.0.0
-> heroku/php@0.0.0
-> heroku/go@0.0.0
-> heroku/nodejs@0.5.13
-> heroku/nodejs-engine@0.8.14
-> heroku/nodejs-npm@0.5.2
-> heroku/nodejs-yarn@0.3.1
-> heroku/procfile@2.0.0
-> heroku/nodejs-function@0.9.17
-> heroku/nodejs-function-invoker@0.3.9
-> heroku/nodejs-npm@0.5.2
-> heroku/nodejs-engine@0.8.14
-> heroku/ruby@2.0.0
Adding buildpack heroku/ruby@2.0.0 (diffID=sha256:c0f828cd72faa714dfd3a25edd3cf974dd81effcbd732d84641717701c3ff323)
Using build cache volume pack-cache-library_test_latest-e9d5f5abcb34.build
Running the creator on OS linux with:
Container Settings:
  Args: /cnb/lifecycle/creator -daemon -launch-cache /launch-cache -log-level debug -app /workspace -cache-dir /cache -run-image heroku/heroku:20-cnb test
  System Envs: CNB_PLATFORM_API=0.10
  Image: pack.local/builder/6769677064747a617571:latest
  User: root
  Labels: map[author:pack]
Host Settings:
  Binds: pack-cache-library_test_latest-e9d5f5abcb34.build:/cache /var/run/docker.sock:/var/run/docker.sock pack-cache-library_test_latest-e9d5f5abcb34.launch:/launch-cache pack-layers-gxrdijswed:/layers pack-app-izstqumhcn:/workspace
  Network Mode:
===> ANALYZING
Previous image with name "test" not found
Analyzing image "3fe950ce0934bc3cbde490e137b1f40f5109f2e1779952717925adb071e3621c"
===> DETECTING
======== Results ========
pass: heroku/ruby@2.0.0
Resolving plan... (try #1)
fail: heroku/ruby@2.0.0 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

Looks like it requires the Node buildpack. If I add that (and fix the URN format) it works as expected.

$ pack build -b urn:cnb:builder:heroku/nodejs,urn:cnb:builder:heroku/ruby -B heroku/buildpacks:20 test
schneems commented 1 year ago

This buildpack isn't published to heroku/buildpacks:20. Can you try with heroku/builder:22 ?

If there's a problem with heroku/buildpacks:20 the the issue is with the CNB shim or the "legacy" buildpack or with the builder or pack https://github.com/heroku/builder/blob/faa27d71e9fb525b7214e95a24561d145f4d62b0/buildpacks-20/builder.toml#L27-L29.

FWIW I'm unable to reproduce the failure with the code from CodeTriage and using heroku/buildpacks:20

$ pack build my-image -B heroku/buildpacks:20 --path . 
20: Pulling from heroku/buildpacks
b549f31133a9: Pull complete 
49eacad9cd1e: Pull complete 
5d0b2919d84d: Pull complete 
fa0988475b08: Pull complete 
ae48c9acc959: Pull complete 
a3e5499f42c1: Pull complete 
ee5aff81b2af: Pull complete 
70e0bea64ce8: Pull complete 
682fcfb7094c: Pull complete 
34481735149f: Pull complete 
6b4345cccf86: Pull complete 
b3a82b74322b: Pull complete 
8302b240c14a: Pull complete 
620dea73bb4a: Pull complete 
51d3dad37b08: Pull complete 
3e16de7dad49: Pull complete 
9f47b28bc209: Pull complete 
631116a8a8a0: Pull complete 
f10dea63a38d: Pull complete 
12aff8b49586: Pull complete 
0836f8ecffda: Pull complete 
e72af6c59c1d: Pull complete 
acfb69560bf5: Pull complete 
ad8eb9c45cc1: Pull complete 
289c6d76c467: Pull complete 
210536913458: Pull complete 
9804be873c4f: Pull complete 
afcf4d4a523c: Pull complete 
8381ed846c61: Pull complete 
d380858d7954: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:a45570ca52ac282068cd9508f768326ae9b838df4e651a57953bd333bf741fa6
Status: Downloaded newer image for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
b549f31133a9: Already exists 
49eacad9cd1e: Already exists 
5d0b2919d84d: Already exists 
0c8be9b6c1c3: Pull complete 
3f6abec86c39: Pull complete 
Digest: sha256:c9d053a463c7cd81672a3b0d5d5e26bdcbdffe2782565ccbedc15867b8cddfb9
Status: Downloaded newer image for heroku/heroku:20-cnb
===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
Warning: Buildpack 'heroku/ruby@0.0.0' requests deprecated API '0.4'
Warning: Buildpack 'heroku/python@0.0.0' requests deprecated API '0.4'
Warning: Buildpack 'heroku/scala@0.0.0' requests deprecated API '0.4'
Warning: Buildpack 'heroku/php@0.0.0' requests deprecated API '0.4'
Warning: Buildpack 'heroku/go@0.0.0' requests deprecated API '0.4'
Warning: Buildpack 'heroku/gradle@0.0.0' requests deprecated API '0.4'
heroku/ruby     0.0.0
heroku/procfile 2.0.0
===> RESTORING
Restoring metadata for "heroku/ruby:gems" from app image
Restoring metadata for "heroku/ruby:ruby" from app image
Restoring metadata for "heroku/ruby:bundler" from app image
Restoring data for "heroku/ruby:bundler" from cache
Restoring data for "heroku/ruby:gems" from cache
Restoring data for "heroku/ruby:ruby" from cache
===> BUILDING
-----> Installing bundler 2.3.25
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.1.2
-----> Installing dependencies using bundler 2.3.25
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/.........
       Fetching rake 13.0.6
       Installing rake 13.0.6
       Fetching erubi 1.11.0
       Fetching builder 3.2.4
       Fetching minitest 5.16.3
       Fetching concurrent-ruby 1.1.10
       Installing erubi 1.11.0
       Using racc 1.6.0
       Fetching crass 1.0.6
       Installing builder 3.2.4
       Installing minitest 5.16.3
       Fetching rack 2.2.4
       Installing crass 1.0.6
       Fetching nio4r 2.5.8
       Fetching websocket-extensions 0.1.5
       Installing concurrent-ruby 1.1.10
       Installing rack 2.2.4
       Installing websocket-extensions 0.1.5
       Installing nio4r 2.5.8 with native extensions
       Fetching marcel 1.0.2
       Installing marcel 1.0.2
       Fetching mini_mime 1.1.2
       Installing mini_mime 1.1.2
       Fetching timeout 0.3.0
       Fetching public_suffix 5.0.0
       Installing timeout 0.3.0
       Fetching ast 2.4.2
       Fetching execjs 2.8.1
       Installing public_suffix 5.0.0
       Fetching aws-eventstream 1.2.0
       Installing ast 2.4.2
       Fetching aws-partitions 1.503.0
       Installing execjs 2.8.1
       Installing aws-eventstream 1.2.0
edmorley commented 1 year ago

@ipmb This issue should be fixed now, can you confirm? :-)

ipmb commented 12 months ago

Hey @edmorley I'm glad this is resolved. I'm no longer working on the Ruby project and won't have time to verify the fix in a timely fashion.