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

Improve NuGet cache log output #151

Merged
merged 12 commits into from
Nov 11, 2024
Merged

Improve NuGet cache log output #151

merged 12 commits into from
Nov 11, 2024

Conversation

runesoerensen
Copy link
Contributor

@runesoerensen runesoerensen commented Nov 10, 2024

This PR changes the log output so nothing is written when the NuGet cache layer is created for the first time. Printing that the cache has been created provides no substantial value (as it really just reflects the fact that a folder has been created at this stage).

Removing the "NuGet cache" output avoids cluttering the output when the buildpack is first executed (while retaining all relevant messages when the cache is restored/reused/purged etc), and when running pack with the --clear-cache flag (and/or when the buildpack is used in an environment that doesn't store/restore the layer cache).

The PR also includes minor changes to terminology, as well as the way the cache restore limit is evaluated, to improve log output and code readability respectively (explained further in the relevant commits).

@runesoerensen runesoerensen added the skip changelog Skip the check-changelog check label Nov 10, 2024
@runesoerensen runesoerensen changed the title Improve nuget log output Improve NuGet cache log output Nov 10, 2024
@runesoerensen runesoerensen marked this pull request as ready for review November 11, 2024 04:00
@runesoerensen runesoerensen requested a review from a team as a code owner November 11, 2024 04:00
NugetCacheLayerMetadata#restore_count is intended to track the number of times the layer has been restored, so it makes more sense to set this value to 0 when the layer has just been created.

This should improve readability by reducing the ambiguity between "number of NuGet package restores" (which are part of every build/publish), and "cache layer restores". Updated the log message wording accordingly.
This is more consistent with the output when the cache is reused, and the logging style used in the SDK layer (and elsewhere)
No need to include "NuGet" in "NuGet cache" sub-bullets
The NuGet CLI uses the term "clear" for related cache maintenance operations, so prefer "clearing" over "purging" in our output https://learn.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders#clearing-local-folders
@runesoerensen runesoerensen force-pushed the improve-nuget-log-output branch from 03dc8ac to 37505f4 Compare November 11, 2024 04:14
@runesoerensen runesoerensen merged commit bf460f8 into main Nov 11, 2024
5 checks passed
@runesoerensen runesoerensen deleted the improve-nuget-log-output branch November 11, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog Skip the check-changelog check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants