Skip to content

Standardize binary cache upload failure diagnostics - #2105

Open
xiaozhuai (xiaozhuai) wants to merge 1 commit into
microsoft:mainfrom
xiaozhuai:main
Open

Standardize binary cache upload failure diagnostics#2105
xiaozhuai (xiaozhuai) wants to merge 1 commit into
microsoft:mainfrom
xiaozhuai:main

Conversation

@xiaozhuai

@xiaozhuai xiaozhuai (xiaozhuai) commented Aug 12, 2026

Copy link
Copy Markdown

Fixes microsoft/vcpkg#28927

Background

Binary cache upload failures currently produce provider-specific diagnostics.

For example, HTTP uploads may report:

warning: curl failed to PUT file

while S3 uploads may report:

warning: ... aws s3 cp ... failed with exit code 1

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:

Binary cache upload failed:

For example:

warning: Binary cache upload failed: curl failed to PUT file ...
warning: Binary cache upload failed: ... aws s3 cp ... failed with exit code 1

The provider-specific diagnostic details are preserved.

Example

./vcpkg install stb --binarysource="http,https://not.found.com/{sha},readwrite;files,/invalid/path,readwrite;x-azblob,https://invalid.blob.core.windows.net/invalid_container,sv=2019-12-12&ss=b&srt=o&sp=rcx&se=2020-12-31T06:20:36Z&st=2020-12-30T22:20:36Z&spr=https&sig=abcd,readwrite;x-gcs,gs://invalid_bucket/,readwrite;x-aws,s3://invalid/,readwrite"
warning: Binary cache upload failed: Failed to store binary cache /invalid/path/95/95584acc45b1951d64da3c3ff9e1e3ae5cecc0ef0de37673e12bdc1ad5feb508.zip
No such file or directory
warning: Binary cache upload failed: curl operation failed with error code 6 (Couldn't resolve host name).
warning: Binary cache upload failed: curl operation failed with error code 6 (Couldn't resolve host name).
warning: Binary cache upload failed: /Users/xiaozhuai/.openclaw/workspace/vcpkg/downloads/tools/gsutil-5.37-osx/gsutil/gsutil -q cp /Users/xiaozhuai/.openclaw/workspace/vcpkg/packages/stb_arm64-osx.zip gs://invalid_bucket/95584acc45b1951d64da3c3ff9e1e3ae5cecc0ef0de37673e12bdc1ad5feb508.zip failed with exit code 1
BucketNotFoundException: 404 gs://invalid_bucket bucket does not exist.

warning: Binary cache upload failed: /opt/homebrew/bin/aws s3 cp /Users/xiaozhuai/.openclaw/workspace/vcpkg/packages/stb_arm64-osx.zip s3://invalid/95584acc45b1951d64da3c3ff9e1e3ae5cecc0ef0de37673e12bdc1ad5feb508.zip failed with exit code 1
upload failed: packages/stb_arm64-osx.zip to s3://invalid/95584acc45b1951d64da3c3ff9e1e3ae5cecc0ef0de37673e12bdc1ad5feb508.zip Unable to locate credentials

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BinaryCache constructor overload to allow injecting a MessageSink (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.

Comment on lines +305 to +307
protected:
BinaryCache(const Filesystem& fs, MessageSink& message_sink);

Comment on lines +219 to +225
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())});
}
Copilot AI review requested due to automatic review settings August 12, 2026 04:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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};

@xiaozhuai

xiaozhuai (xiaozhuai) commented Aug 12, 2026

Copy link
Copy Markdown
Author

Billy O'Neal (@BillyONeal) Victor Romero (@vicroms)
Hi guys, I really want to see this feature implemented, so I’ve close #2071, and reimplemented it to output only a unified log. Let’s move forward with this. Thank you for your time.

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.

[vcpkg] Let it fails when uploading binary caching failed

2 participants