cloudfoundry/php-buildpack

can't build php_buildpack from ubuntu jammy

psycofdj opened this issue ยท 11 comments

Q: What version of the buildpack you are using?
A: v4.5.0

Q: If you were attempting to accomplish a task, what was it you were attempting to do?
A: compile the buildpack from source (cached for stack cflinuxfs3)

Q: What did you expect to happen?
A: the buildpack php_buildpack-cached-cflinuxfs3-v4.5.0.zip to be generated

Q: What was the actual behavior?
A: bundler fails with Your Ruby version is 3.0.2, but your Gemfile specified ~> 2.3

Step to reproduce

$ docker run -ti -v$(pwd):/workdir --rm ubuntu:jammy
# cd /workdir
# apt-get update && apt-get install -y ruby ruby-dev
# gem install bundler -v 2.1.4
# BUNDLE_GEMFILE=cf.Gemfile bundle

Your Ruby version is 3.0.2, but your Gemfile specified ~> 2.3

Analysis:

  • ubuntu jammy baseline uses ruby 3.x
  • ruby 2.x can't be compiled from source as it requires openssl < 3.0.0 which is not simply available on ubuntu jammy

@psycofdj we are currently working on supporting this buildpack on cflinuxfs4 (jammy). We have tracked this work here cloudfoundry/php-buildpack-release#2 (comment)

Thanks @sophiewigmore for the notice

Just to clarify things: this issue is about building the buildpack on jammy when, from my understanding, issue cloudfoundry/php-buildpack-release#2 is about running the buildpack on ubuntu jammy (aka cflinuxfs4).

Does the work toward supporting cflinuxfs4 include the buildpack build process ?

@psycofdj ah yes. Building on Jammy is a separate issue, you're right. That being said, this issue is on our radar though, but separately from the issue I linked

Although, I guess building the buildpack on Jammy is kind of a part of being able to run on Jammy so it may end up getting addressed with those concerns

That was my guess too, although building the buildpack is more related to buildpack-packager rather than the buildpack dependencies itself.

Wouldn't this be a good opportunity to migrate from buildpack-packager to libbuildpack ?

I've been thinking about this and I was wondering if you could elaborate on your use case a bit? Normally when I package the buildpack myself, I run it on a Ruby docker image, not Ubuntu bionic or jammy. Where the buildpack itself is packaged doesn't have a bearing on the stacks the buildpack is compatible with. Why do you specifically need to be able to compile on the ubuntu:jammy image?

My goal is not to use ubuntu:jammy per say but rather using an up-to-date version of ruby (or any other software required by the building process).

If i'm not mistaken, ruby 2.3 (as specified in the Gemfile) is tagged end of life since 31 Mar 2019 and latest 2.x version (ruby 2.7.7) expires in few weeks. Currently supported ruby versions are 3.0, 3.1 and 3.2. The ruby version shipped in ubuntu:jammy baseline being 3.0.

My team and I make an habit to always match the ubuntu version used in the CF stemcell for our entire production, including CI jobs. This helps us identifying those kind of hidden debt and possible security concerns. We fell into this problem when we recently migrated from ubuntu:bionic baseline to ubuntu:jammy.

@psycofdj that's helpful information. We're working on bumping to 3.0 in #815 which should resolve the core of this issue for you then

๐Ÿ‘ thank you and your team for your amazing work

@psycofdj Added support for packaging buildpack in Jammy. Also, there is a new script called /scripts/package.sh that handles all the packaging tasks and doesn't require any ruby version in your machine (it uses docker to run the buildpack-packager).

Amazing ! I confirm everything is building fine since release v4.6.0 using ruby 3.0.

The script package.sh would require docker-in-docker in our CI/CD so we'll stick with plain old buildpack packager but I'm sure this will help plenty of other users.