Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifecycle fails to build on a stack other than bionic #1355

Closed
robdimsdale opened this issue May 13, 2024 · 2 comments
Closed

Lifecycle fails to build on a stack other than bionic #1355

robdimsdale opened this issue May 13, 2024 · 2 comments
Labels
status/triage type/bug Something isn't working

Comments

@robdimsdale
Copy link

Summary / Reproduction

Given:

  • a buildpack with multiple stacks defined in the buildpack.toml and
  • no targets defined in buildpack.toml and
  • one of the stacks is bionic and
  • we are building on a different stack (e.g. jammy)

Then:

The build fails with the following output:

            [detector] Checking for match against descriptor: {linux amd64  [{ubuntu 18.04}]}
            [detector] target distro name/version labels not found, reading /etc/os-release file
            [detector] target distro name/version labels not found, reading /etc/os-release file
            [detector] ======== Error: paketo-buildpacks/mri@1.2.3 ========
            [detector] unable to satisfy target os/arch constraints; run image: {"os":"linux","arch":"amd64"}, buildpack: [{"os":"linux","arch":"amd64","distros":[{"name":"ubuntu","version":"18.04"}]}]

I think this is due to this line in the lifecycle:

			if stack.ID == "io.buildpacks.stacks.bionic" {
				descriptor.Targets = append(descriptor.Targets, TargetMetadata{OS: "linux", Arch: "amd64", Distros: []OSDistro{{Name: "ubuntu", Version: "18.04"}}})

Suggested fix

I would suggest one of the following fixes:

  • remove the magic line (i.e. don't convert stacks to targets at all). This seems the most logical to me as a buildpack author, because (I think) I don't see any value in the conversion from stacks to targets during my build phase.
  • check that there is exactly one stack present, and that this single stack is bionic. This keeps the spirit of the current behavior of converting bionic stack to targets, while dropping the incorrect conversion when there are multiple stacks.
  • add magic lines for other commonly used stacks (e.g. jammy). This preserves the conversion from stacks to targets for bionic and other common stacks, but suffers from the question of: "which stacks do we support"?

Context

lifecycle version

v0.19.4 and v0.19.5 - older versions are not affected

platform version(s)

any platform

@robdimsdale robdimsdale added status/triage type/bug Something isn't working labels May 13, 2024
@natalieparellano
Copy link
Member

I think we could do

check that there is exactly one stack present, and that this single stack is bionic. This keeps the spirit of the current behavior of converting bionic stack to targets, while dropping the incorrect conversion when there are multiple stacks.

without any further changes to the spec. But, we will probably want to revisit this logic as we further deprecate stacks to ensure we don't hit more roadblocks like this in the future.

@robdimsdale
Copy link
Author

@natalieparellano makes total sense, thanks.

FWIW the bionic stack is deprecated over in Paketo. I think if we want to continue with this automatic conversion of stack IDs, we should definitely include Jammy (as the only supported Paketo stack)

natalieparellano added a commit that referenced this issue May 14, 2024
… succeed

Fixes #1355

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants