php-buildpack: CATs php-buildpack tests fails on cflinuxfs4 / php-buildpack v4.6.2

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?

v27.3.0 (develop branch) / CF CLI 8.6.1+b5a352a.2023-02-27

What version of the buildpack you are using?

v4.6.2

If you were attempting to accomplish a task, what was it you were attempting to do?

Executed CATs buildpack detect test: https://github.com/cloudfoundry/cf-acceptance-tests/blob/eeadb781ea7dd0a84474c83fb5c72258821ab44c/detect/buildpacks.go#L133 This is the CATs configuration:

{
  "api": "api.cf.hermione.env.wg-ard.ci.cloudfoundry.org",
  "admin_user": "admin",
  "admin_password": "<redacted>",
  "apps_domain": "cf.hermione.env.wg-ard.ci.cloudfoundry.org",
  "skip_ssl_validation": false,
  "use_http": true,
  "timeout_scale": 1.5,
  "credhub_mode": "assisted",
  "include_apps": true,
  "include_backend_compatibility": false,
  "include_deployments": false,
  "include_detect": true,
  "include_docker": false,
  "include_internet_dependent": false,
  "include_private_docker_registry": false,
  "private_docker_registry_image": "cfdeploymentprivateregistry/privatecats",
  "private_docker_registry_username": "<redacted>",
  "private_docker_registry_password": "<redacted>",
  "include_route_services": false,
  "include_routing": false,
  "include_security_groups": false,
  "include_service_discovery": false,
  "include_service_instance_sharing": false,
  "include_services": false,
  "include_ssh": false,
  "include_sso": false,
  "include_tasks": false,
  "include_tcp_routing": false,
  "include_v3": true,
  "include_windows": false,
  "include_zipkin": false,
  "include_container_networking": false,
  "include_log_cache": false,
  "include_volume_services": false,
  "include_user_provided_services": false,
  "stacks": [
    "cflinuxfs4"
  ],
  "credhub_secret": "<redacted>",
  "credhub_client": "credhub_admin_client"
}

What did you expect to happen?

Test should succeed.

What was the actual behavior?

See error log in https://concourse.wg-ard.ci.cloudfoundry.org/teams/main/pipelines/cf-deployment/jobs/experimental-cats-cflinuxfs4/builds/144

[2023-03-29 05:51:01.65 (UTC)]> cf push CATS-2-APP-17faad697b59f181 -m 256M -p assets/php -s cflinuxfs4 
  Pushing app CATS-2-APP-17faad697b59f181 to org CATS-2-ORG-2e04424649af3c05 / space CATS-2-SPACE-10f67f3ebef66921 as CATS-2-USER-2b1176c4120259e1...
  Packaging files to upload...
  Uploading files...
 480 B / 480 B [========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================] 100.00% 1s

  Waiting for API to complete processing files...

  Staging app and tracing logs...
     Downloading binary_buildpack...
     Downloading buildpack-cflinuxfs4-lifecycle...
     Downloading staticfile_buildpack...
     Downloading java_buildpack...
     Downloading ruby_buildpack...
     Downloaded buildpack-cflinuxfs4-lifecycle
     Downloading dotnet_core_buildpack...
     Downloaded dotnet_core_buildpack
     Downloading nodejs_buildpack...
     Downloaded ruby_buildpack
     Downloading go_buildpack...
     Downloaded java_buildpack
     Downloading python_buildpack...
     Downloaded staticfile_buildpack
     Downloading php_buildpack...
     Downloaded binary_buildpack
     Downloading nginx_buildpack...
     Downloaded nodejs_buildpack
     Downloading r_buildpack...
     Downloaded python_buildpack
     Downloaded nginx_buildpack
     Downloaded go_buildpack
     Downloaded php_buildpack
     Downloaded r_buildpack
     Cell 00e3f17d-a839-4587-94b5-6cfabc6cabf0 creating container for instance a15138b2-ff2d-461c-a080-71623cd14770
     Security group rules were updated
     Cell 00e3f17d-a839-4587-94b5-6cfabc6cabf0 successfully created container for instance a15138b2-ff2d-461c-a080-71623cd14770
     Downloading app package...
     Downloaded app package (480B)
     /tmp/ruby/lib/ruby/3.1.0/psych/class_loader.rb:99:in `find': Tried to load unspecified class: Date (Psych::DisallowedClass)
     from /tmp/ruby/lib/ruby/3.1.0/psych/class_loader.rb:28:in `load'
     from (eval):2:in `date'
     from /tmp/ruby/lib/ruby/3.1.0/psych/scalar_scanner.rb:66:in `tokenize'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:65:in `deserialize'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:128:in `visit_Psych_Nodes_Scalar'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `block in register_empty'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `each'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:338:in `register_empty'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:146:in `visit_Psych_Nodes_Sequence'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:345:in `block in revive_hash'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `each_slice'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:343:in `revive_hash'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:167:in `visit_Psych_Nodes_Mapping'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:318:in `visit_Psych_Nodes_Document'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:30:in `visit'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/visitor.rb:6:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:35:in `accept'
     from /tmp/ruby/lib/ruby/3.1.0/psych.rb:334:in `safe_load'
     from /tmp/ruby/lib/ruby/3.1.0/psych.rb:369:in `load'
     from /tmp/ruby/lib/ruby/3.1.0/psych.rb:671:in `block in load_file'
     from /tmp/ruby/lib/ruby/3.1.0/psych.rb:670:in `open'
     from /tmp/ruby/lib/ruby/3.1.0/psych.rb:670:in `load_file'
     from /tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/compile-extensions/bin/default_version_for:14:in `initialize'
     from /tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/compile-extensions/bin/default_version_for:58:in `new'
     from /tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/compile-extensions/bin/default_version_for:58:in `<main>'
     Traceback (most recent call last):
     File "/tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/scripts/detect.py", line 20, in <module>
     (Builder()
     File "/tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/lib/build_pack_utils/builder.py", line 949, in configure
     self._ctx = CloudFoundryUtil.initialize()
     File "/tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/lib/build_pack_utils/cloudfoundry.py", line 64, in initialize
     ctx = CloudFoundryUtil.update_default_version(dependency, manifest_file, ctx)
     File "/tmp/buildpacks/40b1dbc9aba48fadbd7fed29b4c6327d/lib/build_pack_utils/cloudfoundry.py", line 79, in update_default_version
     raise RuntimeError("Error detecting %s default version" % dependency.upper())
     RuntimeError: Error detecting PHP default version
     None of the buildpacks detected a compatible application
     Exit status 222
     Cell 00e3f17d-a839-4587-94b5-6cfabc6cabf0 stopping instance a15138b2-ff2d-461c-a080-71623cd14770
     Cell 00e3f17d-a839-4587-94b5-6cfabc6cabf0 destroying container for instance a15138b2-ff2d-461c-a080-71623cd14770
     Cell 00e3f17d-a839-4587-94b5-6cfabc6cabf0 successfully destroyed container for instance a15138b2-ff2d-461c-a080-71623cd14770
  NoAppDetectedError - An app was not successfully detected by any available buildpack
  FAILED
  [FAILED] in [It] - /go/src/github.com/cloudfoundry/cf-acceptance-tests/detect/buildpacks.go:149 @ 03/29/23 05:51:28.667

Please confirm where necessary:

  • I have included a log output
  • My log includes an error message
  • I have included steps for reproduction

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (13 by maintainers)

Most upvoted comments

https://github.com/cloudfoundry/php-buildpack/pull/855 should fix this.

The issue is that during the detect phase, multiple buildpacks provide their own ruby (as we have removed it from the stack). All buildpacks look in /tmp/ruby/ for this provided ruby. But, the php buildpack requires a different version of ruby than the others (3.0 vs 3.1). This issue is resolved by installing (and looking for) ruby under a unique namespace e.g. /tmp/php-buildpack/ruby/.

This issue doesn’t show up when running cf push -b - i.e. when skipping detect - because only during detect do multiple buildpacks run on the same filesystem in sequence. It’s possible this would be an issue when using the php buildpack in a multi-buildpack scenario with another buildpack first, but we didn’t validate that. Regardless, the fix above should resolve the issue.

I’ve sent access credentials via Slack to rdz. Once the deploy job finishes successfully, you can try to reproduce the problem. Thanks for the quick support!

Ok, then I’ll start the experimental jobs, but they won’t finish before our EOB. I can provide you the access information tomorrow on Slack.

I am looking into this!