ruby
                                
                                
                                
                                    ruby copied to clipboard
                            
                            
                            
                        Failure to detect Ruby app from the Buildpacks sample directory
What happened?
I tried to build a ruby app with the base (paketobuildpacks/builder:base) and full (paketobuildpacks/builder:full) builder but they couldn't detect the app, and thus nothing was built. I'm using the sample app in the buildpacks sample repo. However, when I switch to Heroku buildpacks or the CNB ones, it was able to detect and build the app.
- What were you attempting to do?
 
Build a Ruby app
- What did you expect to happen?
 
Detect the app and package it.
- What was the actual behavior? Please provide log output, if possible.
 
===> 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
Build Configuration
- What platform (
pack,kpack,tektonbuildpacks plugin, etc.) are you using? Please include a version. 
Tekton
- 
What buildpacks are you using? Please include versions.
 - 
What builder are you using? If custom, can you provide the output from
pack inspect-builder <builder>? 
paketobuildpacks/builder:base and paketobuildpacks/builder:full
- Can you provide a sample app or relevant configuration (
buildpack.yml,nginx.conf, etc.)? 
https://github.com/buildpacks/samples/tree/main/apps/ruby-bundler
It seems that the problem lies with the Paketo Ruby buildpack, since I was able to reproduce this issue using when specifying the Paketo Ruby buildpack explicitly. I used pack -v to see the verbose detection output:
pack build ruby-sample --buildpack gcr.io/paketo-buildpacks/ruby --builder paketobuildpacks/builder:base -v
In the detection output, I see that none of the ruby order groups pass detection. I'm going to transfer this issue to the paketo-buildpacks/ruby repo so the @paketo-buildpacks/ruby-maintainers can help troubleshoot.
This is interesting. I was able to build and run the app using the cnbs/sample-builder:bionic builder. Its easy to see why this would work as the sample buildpack is quite contrived in what it supports. We can see that they hardcode the start command to bundle exec ruby app.rb.
More interestingly, I was also able to build the app with the heroku/buildpacks:20 builder, but then was unable to get it to run.
$ docker run -it ruby-heroku
Hello from .profile
configuration /workspace/config.ru not found
Jumping into the built image I can see the following processes are declared:
heroku@4f6604a648f8:/workspace$ cat /layers/config/metadata.toml
buildpack-default-process-type = "web"
[[buildpacks]]
  api = "0.2"
  id = "heroku/ruby"
  version = "0.0.1"
[[processes]]
  type = "console"
  command = "bundle exec irb"
  direct = false
  buildpack-id = "heroku/ruby"
[[processes]]
  type = "rake"
  command = "bundle exec rake"
  direct = false
  buildpack-id = "heroku/ruby"
[[processes]]
  type = "web"
  command = "bundle exec rackup config.ru -p ${PORT:-5000}"
  direct = false
  buildpack-id = "heroku/ruby"
It appears the buildpack is detecting that this app needs to use rackup to start, but failing to notice that there isn't a config.ru or other rackup file to read. Ultimately, this means the app builds, but doesn't really run, at least not without other configuration input from the user.
I think we need more input about what is expected from this case. We have an application that presents as a simple app.rb file. Almost anything could be written in that file, not to mention that it could be named almost anything. For Node.js, for instance, we have a list of special files that we look for as a last resort.
Should we enable something similar for Ruby? If so, what are those special files?
@ryanmoran I'm happy to take a look at implementing some improved detect logic here, but I don't have enough context on the ruby ecosystem to form opinions on what special files the ruby buildpack might look for, and, perhaps more importantly, how we might validate the contents of those special files.
It is also not obvious to me where that logic would live, as there is no "ruby-start" buildpack similar to the node/python ecosystems. It doesn't seem like this logic should live in the rackup buildpack, either. We could create a ruby-start buildpack, but even if we did, I am not sure that buildpack should create a bundle exec ruby <some-special-file> command, as that seems quite coupled to the bundler order group.
@pmbanugo I see your 👍 on the comment above. Do you have thoughts on what a solution might look like, and what special files might the ruby buildpack look for? No worries if not - I'm just seeking any and all input possible!
No, I'm not so familiar with Ruby to offer any opinion.