Standardize binary cache upload failure diagnostics - #2105
Standardize binary cache upload failure diagnostics#2105xiaozhuai (xiaozhuai) wants to merge 1 commit into
Conversation
a535eb5 to
3cbe478
Compare
There was a problem hiding this comment.
Pull request overview
This PR standardizes diagnostics for binary cache upload failures in vcpkg by prepending a consistent, localizable prefix to provider-specific failure messages, making CI log parsing more reliable.
Changes:
- Introduces a diagnostic-context wrapper that prefixes upload warnings/errors with
Binary cache upload failed: .... - Adds a
BinaryCacheconstructor overload to allow injecting aMessageSink(enables testability). - Adds a regression test validating the standardized warning prefix is emitted on upload failure.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vcpkg/binarycaching.cpp | Adds BinaryCacheUploadDiagnosticContext and routes provider upload diagnostics through it; refactors BinaryCache constructor to support sink injection. |
| include/vcpkg/binarycaching.h | Exposes a protected BinaryCache(fs, message_sink) constructor for tests/derivations. |
| src/vcpkg-test/binarycaching.cpp | Adds a targeted test using an injected sink/provider to assert standardized upload-failure logging. |
| include/vcpkg/base/message-data.inc.h | Declares the new localized message key for the standardized prefix. |
| locales/messages.json | Adds the generated message entry for BinaryCacheUploadFailed. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| protected: | ||
| BinaryCache(const Filesystem& fs, MessageSink& message_sink); | ||
|
|
| void report(const DiagnosticLine& line) override | ||
| { | ||
| if (line.kind() == DiagKind::Error || line.kind() == DiagKind::Warning) | ||
| { | ||
| inner_context.report(DiagnosticLine{ | ||
| line.kind(), msg::format(msgBinaryCacheUploadFailed).append_raw(": ").append(line.message_text())}); | ||
| } |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/vcpkg/binarycaching.cpp:3009
- The new upload_context is only used for provider->push_success(), but ZIP creation failures still report diagnostics through pdc. This means a common “upload pipeline” failure (zip tool returning nonzero) won’t get the standardized "Binary cache upload failed:" prefix, so CI log parsing still won’t consistently detect upload failures.
PrintingDiagnosticContext pdc{m_bg_msg_sink};
WarningDiagnosticContext wdc{pdc};
BinaryCacheUploadDiagnosticContext upload_context{pdc};
|
Billy O'Neal (@BillyONeal) Victor Romero (@vicroms) |
Fixes microsoft/vcpkg#28927
Background
Binary cache upload failures currently produce provider-specific diagnostics.
For example, HTTP uploads may report:
while S3 uploads may report:
This makes it difficult for CI systems to reliably detect binary cache upload failures by parsing the log.
Changes
Prepend a standardized message to existing binary cache upload failure diagnostics:
For example:
The provider-specific diagnostic details are preserved.
Example