gtristan commented on code in PR #1895:
URL: https://github.com/apache/buildstream/pull/1895#discussion_r1510999984
##########
src/buildstream/downloadablefilesource.py:
##########
@@ -25,6 +25,66 @@
implementation.
+SourceMirror extra data "auth-header-format"
+--------------------------------------------
+The DownloadableFileSource, and consequently any :class:`Source
<buildstream.source.Source>`
+implementations which derive from DownloadableFileSource, support the
"auth-header-format"
+extra data returned by :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+through :func:`Source.translate_url()
<buildstream.source.Source.translate_url>`.
+
+This functionality is available **Since: 2.2**.
+
+This allows one to use :class:`SourceMirror
<buildstream.sourcemirror.SourceMirror>` plugins
+to add an authorization header to the ``GET`` requests.
+
+
+**Example:**
+
+.. code:: python
+
+ class MySourceMirror(SourceMirror):
Review Comment:
I'm in favor of:
* Extending this such that we can allow overriding the _default
SourceMirror_ definition
* So it can be used in regular URL translation, even for the default aliaes
* Possibly changing the `extra_dict` to be public data
* As I already pointed out elsewhere, to you @abderrahim and to @juergbi,
using a `public_data` like approach was my initial idea
* This however means further extending the APIs such that `Source.fetch()`
and `Source.track()` have access to the `SourceMirror` object, which is not
nicely doable in the API either (we cannot _add keyword arguments_ to these
APIs without breaking API for existing implementations, so we'd need additional
ugly API growth like `Source.track_with_mirror()` and similar warts and
blemishes...).
* I **think** at this point, I'm more happy with having the user provide a
plugin with a single `translate_url()` function implementation rather than
churning the API that much
* Please remember: _"I think" != "I'm sure"_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]