Only log once (per phase) when we have to get target distro information from /etc/os-release #1424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When the run image does NOT have
io.buildpacks.base.distro.name
orio.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 callGetTargetOSFromFileSystem
- which happens a LOT, especially during the detect phase. We do this: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.