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

pack build fails on v0.2.0 #121

Closed
ngatti-tmm opened this issue Jun 26, 2024 · 5 comments
Closed

pack build fails on v0.2.0 #121

ngatti-tmm opened this issue Jun 26, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@ngatti-tmm
Copy link

Hello, today I tried to build my app and failed. When running pack build on a php application I get the following error:

pack build --trust-builder -v ${IMAGE_NAME}:${BITBUCKET_COMMIT} --builder heroku/builder:24 \
    -t ${IMAGE_NAME}:latest --publish --cache-image ${CACHE_IMAGE_NAME}  \
    --buildpack heroku/php --default-process web

[.....]

===> BUILDING
Timer: Builder started at 2024-06-26T16:29:08Z
target distro name/version labels not found, reading /etc/os-release file
Running build for buildpack heroku/php@0.2.0
Looking up buildpack
Finding plan
Creating plan directory
Preparing paths
Running build command
thread 'main' panicked at buildpacks/php/src/main.rs:65:14:
Internal error: could not determine Heroku stack name for OS/distro: "-ubuntu-24.04"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Timer: Builder ran for 7.244296ms and ended at 2024-06-26T16:29:08Z
ERROR: failed to build: exit status 101
ERROR: failed to build: executing lifecycle: failed with status code: 51

The same pack build command worked ok on v0.1.2.

I tried with heroku/builder:22 and heroku/builder:20, and removing --buildpack heroku/php parameter, same error.

@dzuelke dzuelke added the bug Something isn't working label Jun 27, 2024
@dzuelke dzuelke self-assigned this Jun 27, 2024
@edmorley
Copy link
Member

edmorley commented Jul 3, 2024

Hi! I'm puzzled by this log line:

target distro name/version labels not found, reading /etc/os-release file

It should not be appearing, since:

  1. Our images do have those labels set (https://github.com/heroku/base-images/blob/2323b38c808bb4eb555bf5965148f6882b987bd8/heroku-24/Dockerfile#L7-L8)
  2. The upstream lifecycle bug that prevented them being picked up was fixed (CNB_TARGET_DISTRO_NAME and CNB_TARGET_DISTRO_VERSION not set correctly in buildpack env buildpacks/lifecycle#1324) and our images are using latest lifecycle that includes that fix

Could you paste the output of running pack report?

@ngatti-tmm
Copy link
Author

ngatti-tmm commented Jul 3, 2024

Sure, here it is:

Pack:
  Version:  0.27.0
  OS/Arch:  linux/amd64
Default Lifecycle Version:  0.14.1
Supported Platform APIs:  0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9
Config:
(no config file found at /root/.pack/config.toml)

I am running pack from a bitbucket runner container.

Here is the full log output of the pack build with --builder heroku/builder:20:

d380858d7954: Verifying Checksum
d380858d7954: Download complete
4f4fb700ef54: Verifying Checksum
4f4fb700ef54: Download complete
8ec873bb179d: Pull complete
a0369ff958dc: Pull complete
da219bf45755: Pull complete
182afb1fe5dc: Pull complete
573b215d26cc: Pull complete
b800596f06dc: Pull complete
230d096637e0: Pull complete
0dc313d19e08: Pull complete
9a96a1ecad0f: Pull complete
57e90387b51d: Pull complete
cd4927f5d199: Pull complete
bc9b1a79737a: Pull complete
dfdef8cdb137: Pull complete
79806adb2e3e: Pull complete
3d16f30831d3: Pull complete
e4a70e78e4ad: Pull complete
cd798f0238ec: Pull complete
b6320bfc33fd: Pull complete
464eddc5e83b: Pull complete
2c910edb2a09: Pull complete
019250ea783e: Pull complete
c65710a064c1: Pull complete
c42e3a590979: Pull complete
47bb7513ab1d: Pull complete
fc6009aef240: Pull complete
d380858d7954: Pull complete
82459881ba5b: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:5321f808f6d85a310cbea8abda0c66b6978bb754c80cb8ad9cb0ec485b36b568
Status: Downloaded newer image for heroku/builder:20
Selected run image 'heroku/heroku:20-cnb'
Setting custom order
Creating builder with the following buildpacks:
-> 'heroku/go@0.4.0'
-> 'heroku/java@6.0.0'
-> 'heroku/gradle@6.0.0'
-> 'heroku/jvm@6.0.0'
-> 'heroku/maven@6.0.0'
-> 'heroku/nodejs@3.2.5'
-> 'heroku/nodejs-corepack@3.2.5'
-> 'heroku/nodejs-engine@3.2.5'
-> 'heroku/nodejs-npm-engine@3.2.5'
-> 'heroku/nodejs-npm-install@3.2.5'
-> 'heroku/nodejs-pnpm-engine@3.2.5'
-> 'heroku/nodejs-pnpm-install@3.2.5'
-> 'heroku/nodejs-yarn@3.2.5'
-> 'heroku/php@0.2.0'
-> 'heroku/procfile@3.1.2'
-> 'heroku/python@0.12.0'
-> 'heroku/ruby@3.0.0'
-> 'heroku/scala@6.0.0'
-> 'heroku/jvm@6.0.0'
-> 'heroku/sbt@6.0.0'
Using build cache volume '123456789012.dkr.ecr.eu-central-1.amazonaws.com/wp-myapp_cache:latest'
Running the 'creator' on OS 'linux' with:
Container Settings:
  Args: '/cnb/lifecycle/creator -log-level debug -app /workspace -cache-dir /cache -run-image heroku/heroku:20-cnb -tag 123456789012.dkr.ecr.eu-central-1.amazonaws.com/wp-myapp:latest -process-type web -cache-image 123456789012.dkr.ecr.eu-central-1.amazonaws.com/wp-myapp_cache:latest 123456789012.dkr.ecr.eu-central-1.amazonaws.com/wp-myapp:6d91497a4a4653f8f87c0160192b1e91d6eca849'
  System Envs: 'CNB_REGISTRY_AUTH=<redacted> CNB_PLATFORM_API=0.9'
  Image: 'pack.local/builder/71767a61766867756678:latest'
  User: 'root'
  Labels: 'map[author:pack]'
Host Settings:
  Binds: 'pack-layers-dkpsfppijm:/layers pack-app-guxqchxmay:/workspace'
  Network Mode: ''
Starting creator...
Parsing inputs...
Ensuring privileges...
Executing command...
===> ANALYZING
Timer: Analyzer started at 2024-07-03T19:19:26Z
Image with name "123456789012.dkr.ecr.eu-central-1.amazonaws.com/wp-myapp:6d91497a4a4653f8f87c0160192b1e91d6eca849" not found
Found image with identifier "index.docker.io/heroku/heroku@sha256:e0ed1f656a1e49460149ad73c615714ba7535b399a48982eca589b3530d5ee24"
Timer: Analyzer ran for 582.541759ms and ended at 2024-07-03T19:19:27Z
Run image info in analyzed metadata is: 
{"Reference":"index.docker.io/heroku/heroku@sha256:e0ed1f656a1e49460149ad73c615714ba7535b399a48982eca589b3530d5ee24","Image":"","Extend":false}
===> DETECTING
Timer: Detector started at 2024-07-03T19:19:27Z
target distro name/version labels not found, reading /etc/os-release file
======== Results ========
pass: heroku/php@0.2.0
Resolving plan... (try #1)
heroku/php 0.2.0
Timer: Detector ran for 7.934738ms and ended at 2024-07-03T19:19:27Z
===> RESTORING
Timer: Restorer started at 2024-07-03T19:19:27Z
Restoring Layer Metadata
Reading buildpack directory: /layers/heroku_php
Restoring metadata for "heroku/php:composer_cache" from cache
Writing layer metadata for "heroku/php:composer_cache"
Restoring metadata for "heroku/php:platform_cache" from cache
Writing layer metadata for "heroku/php:platform_cache"
Restoring metadata for "heroku/php:shim" from cache
Writing layer metadata for "heroku/php:shim"
Reading Buildpack Layers directory /layers
Reading buildpack directory: /layers/heroku_php
Reading buildpack directory item: composer_cache.toml
Reading buildpack directory item: platform_cache.toml
Reading buildpack directory item: shim.toml
Restoring data for "heroku/php:composer_cache" from cache
Restoring data for "heroku/php:platform_cache" from cache
Restoring data for "heroku/php:shim" from cache
Retrieving data for "sha256:9ef5011a080c7eb5aa190f752959e32f92335cdb80dde52199ed5a87ba9f6d9e"
Retrieving data for "sha256:6d3489c03b8be6a39f83075b075f60ca117a4e32d33348cc59952a42996c8365"
Retrieving data for "sha256:a08370ff5d1e1eb43b617b186599859f181ba1d93cdcecdef9d239cdb96aea7e"
Timer: Restorer ran for 5.001450303s and ended at 2024-07-03T19:19:32Z
===> BUILDING
Timer: Builder started at 2024-07-03T19:19:32Z
target distro name/version labels not found, reading /etc/os-release file
Running build for buildpack heroku/php@0.2.0
Looking up buildpack
Finding plan
Creating plan directory
Preparing paths
Running build command
thread 'main' panicked at buildpacks/php/src/main.rs:65:14:
Internal error: could not determine Heroku stack name for OS/distro: "-ubuntu-20.04"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Timer: Builder ran for 7.129431ms and ended at 2024-07-03T19:19:32Z
ERROR: failed to build: exit status 101
ERROR: failed to build: executing lifecycle: failed with status code: 51

@edmorley
Copy link
Member

edmorley commented Jul 4, 2024

@ngatti-tmm Thank you - that allowed me to reproduce.

The issue is that:

  1. You are using a very old Pack CLI version (0.27.0 from June 2022, when 0.34.2 is the latest)
  2. The old Pack CLI version doesn't support CNB Platform API 0.10, so runs the build using Platform API 0.9, and there appears to be a lifecycle bug when using that older API version, which I've just reported upstream: CNB_TARGET_ARCH and CNB_TARGET_OS not set correctly when using Platform API 0.9 buildpacks/lifecycle#1371

Once the upstream lifecycle bug is fixed and released in a new version, we will update our builder images to use that new release, eg here:
https://github.com/heroku/cnb-builder-images/blob/786bd787f190de30e8302cc64b4da121d98a4951/builder-24/builder.toml#L8-L9

In the meantime you'll need to update to a newer Pack CLI version - which is worth doing regardless to pick up new features and fixes in the Pack CLI :-)

@ngatti-tmm
Copy link
Author

Thank you Ed. I wrongly asumed that the Pack CLI was installed on each pipeline. But it was installed on the base build image and as it wasn't updated.
I updated Pack CLI manually and now deployment worked ok.
Thank you very much for your help.

@edmorley
Copy link
Member

edmorley commented Jul 4, 2024

No problem! Thank you for reporting the issue - it let me find an upstream bug which would be great to have fixed regardless :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants