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

Only log once (per phase) when we have to get target distro information from /etc/os-release #1424

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

natalieparellano
Copy link
Member

@natalieparellano natalieparellano commented Nov 14, 2024

Summary

When the run image does NOT have io.buildpacks.base.distro.name or io.buildpacks.base.distro.version labels:

We're currently emitting an info message "target distro name/version labels not found, reading /etc/os-release file" every time we call GetTargetOSFromFileSystem - which happens a LOT, especially during the detect phase. We do this:

  • For every buildpack, for every target that the buildpack declares, until we find a target that matches the base image
  • For every buildpack, when we run ./bin/detect

This is very noisy, and annoying because it isn't information that buildpack authors need. We should only log the message once, so that platform operators / builder creators can see that the run image needs to be updated with a label.

Release notes

The lifecycle only logs once (per phase) when reading distro information from /etc/os-release in order to construct target information


Related

Resolves #___


Context

The updated code is still a bit inefficient, as we should really only be calling GetTargetOSFromFileSystem once per phase, but I've enforced that we only log the info message once, and by saving the distro information the first time we read /etc/os-release, we end up only reading that file once. I didn't want to tear apart too much of the existing code in the interest of time.

…on from /etc/os-release

Signed-off-by: Natalie Arellano <narellano@vmware.com>
…o that we end up only reading that file once

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano requested a review from a team as a code owner November 14, 2024 19:11
@natalieparellano natalieparellano merged commit 21811fa into main Nov 15, 2024
7 checks passed
@natalieparellano natalieparellano deleted the fix/target-log branch November 15, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants