Skip to content

Fix URL SCM mirror upload - #724

Merged
jkloetzke merged 8 commits into
BobBuildTool:masterfrom
jkloetzke:fix-mirror-upload
Oct 30, 2026
Merged

jkloetzke merged 8 commits into
BobBuildTool:masterfrom
jkloetzke:fix-mirror-upload

Conversation

@jkloetzke

Copy link
Copy Markdown
Member

The HTTP upload of URL mirrors was not spec compliant. We cannot rely on the server to create the parent directories.

While at it, add an ignoreUploadErrors property to make error non-fatal.

Allow the caller to pass additional request headers to openDownload().
This enables conditional downloads with "If-Modified-Since".
A "304 Not Modified" response is reported as WebdavNotModifiedError so
that it can be distinguished from real errors.
Replace the hand-rolled urllib requests for http and https URLs by the
WebDav class. This adds support for HTTP basic authentication with the
credentials embedded in the URL and keeps them out of error messages.
Uploads are done with "If-None-Match" now. Losing the race against a
concurrent upload is not an error. The ftp downloads still use urllib
directly.

The retries are still handled by UrlScm to keep the delay between the
attempts and the warnings.
Add optional HTTP basic authentication to the HTTP server mock. Use it
to verify that UrlScm downloads and mirror uploads work with
credentials embedded in the URL. The password contains reserved
characters to check the proper unquoting. Wrong credentials must fail.
Quoting RFC 4918:

  A PUT that would result in the creation of a resource without an
  appropriately scoped parent collection MUST fail with a 409
  (Conflict).

Like the HttpArchive, make sure that the parent directories exist
before uploading a file to a HTTP mirror.
Let the HTTP server mock fail a PUT with 409 if the parent collection
is missing, as mandated by RFC 4918, instead of silently creating it.
Add a test that uploads to a HTTP mirror into a missing sub-directory.
Uploading to a mirror might not always be possible, e.g. if the mirror
is not always reachable or writable. Add an "ignoreUploadErrors"
property to the UrlScm mirror entries. If set, a failed upload is only
reported as warning instead of failing the build.

As a side effect, errors when copying to local mirrors are reported
properly instead of being raised as unhandled exceptions.
Verify that failed uploads to HTTP and local mirrors fail the build by
default and that they are ignored if "ignoreUploadErrors" is set.
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.46341% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.96%. Comparing base (55cf381) to head (27fafe6).

Files with missing lines Patch % Lines
pym/bob/scm/url.py 90.41% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #724      +/-   ##
==========================================
- Coverage   89.96%   89.96%   -0.01%     
==========================================
  Files          50       50              
  Lines       16993    17022      +29     
==========================================
+ Hits        15287    15313      +26     
- Misses       1706     1709       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jkloetzke
jkloetzke merged commit 3e2d061 into BobBuildTool:master Oct 30, 2026
11 checks passed
@jkloetzke
jkloetzke deleted the fix-mirror-upload branch October 30, 2026 13:32
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.

1 participant