bitbake: Add Azure Storage fetcher implementation
PATCH 1/3 bitbake: Add Azure Storage fetcher implementation
Allows bitbake to fetch from an Azure Storage account.
The fetcher submodule is compatible with the az:// URI protocol, its functionality is based on bitbakes wget fetcher, superior in performance to using a propietary tool like azcopy which can handle cloud storage account operations with more functionality (that we dont need in a fetcher) but less compatibility.
A sample URI uses can be defined in the following way:
SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<container>/foo.tar.xz"
This fetcher can easily be used with PREMIRRORS and SSTATE_MIRRORS, e.g.:
SSTATE_MIRRORS = "file://.* az://<azure-storage-account>.blob.core.windows.net/sstate-cache/PATH;downloadfilename=PATH \n"
PREMIRRORS_prepend = "\
git://.*/.* az://<azure-storage-account>.blob.core.windows.net/downloads/ \n \
ftp://.*/.* az://<azure-storage-account>.blob.core.windows.net/downloads/ \n \
http://.*/.* az://<azure-storage-account>.blob.core.windows.net/downloads/ \n \
https://.*/.* az://<azure-storage-account>.blob.core.windows.net/downloads/ \n \
"
Can also be used with non-public access Azure Storage accounts/containers via a Shared Access Signature by declaring the AZ_SAS variable which will be automatically used by the fetcher:
AZ_SAS="?sv=2000-01-01&ss=...&sig=somesignature"
--- lib/bb/fetch2/__init__.py | 4 +- lib/bb/fetch2/az.py | 93 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 lib/bb/fetch2/az.py
lib/bb/fetch2/__init__.py +3 -1
@@ -1243,7 +1243,7 @@ class FetchData(object): if checksum_name in self.parm: checksum_expected = self.parm[checksum_name] - elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3"]: + elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az"]: checksum_expected = None else: checksum_expected = d.getVarFlag("SRC_URI", checksum_name)
@@ -1908,6 +1908,7 @@ from . import repo from . import clearcase from . import npm from . import npmsw +from . import az methods.append(local.Local()) methods.append(wget.Wget())
@@ -1927,3 +1928,4 @@ methods.append(repo.Repo()) methods.append(clearcase.ClearCase()) methods.append(npm.Npm()) methods.append(npmsw.NpmShrinkWrap()) +methods.append(az.Az())
lib/bb/fetch2/az.py new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/3 docs: Add Az fetcher documentation
--- .../bitbake-user-manual-fetching.rst | 28 +++++++++++++++++++ .../bitbake-user-manual-ref-variables.rst | 2 ++ 2 files changed, 30 insertions(+)
doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +28 -0
@@ -624,6 +624,34 @@ Here are some example URLs: :: SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml" SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml" +.. _az-fetcher: + +Az Fetcher (``az://``) +-------------------------- + +This submodule fetches data from an +`Azure Storage account <https://docs.microsoft.com/en-us/azure/storage/>`__ , +it inherits its functionality from the HTTP wget fetcher, but modifies its +behavior to accomodate the usage of a +`Shared Access Signature (SAS) <https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview>`__ +for non-public data. + +Such functionality is set by the variable: + +- :term:`AZ_SAS`: The Azure Storage Shared Access Signature provides secure + delegate access to resources, if this variable is set, the Az Fetcher will + use it when fetching artifacts from the cloud. + +You can specify the AZ_SAS variable as shown below: :: + + AZ_SAS = "se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>" + +Here is an example URL: :: + + SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<foo_container>/<bar_file>" + +It can also be used when setting mirrors definitions using the :term:`PREMIRRORS` variable. + Other Fetchers --------------
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +2 -0
@@ -1303,6 +1303,8 @@ overview of their function and contents. - ``svn://`` : Fetches files from a Subversion (``svn``) revision control repository. + - ``az://`` : Fetches files from an Azure Storage account using HTTPS. + Here are some additional options worth mentioning: - ``unpack`` : Controls whether or not to unpack the file if it is
Signature · 1 line
2.25.1
PATCH 3/3 docs: Add AZ_SAS definition to glossary
In reply to Alejandro Hernandez Samaniego--- .../bitbake-user-manual-ref-variables.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+)
doc/bitbake-user-manual/bitbake-user-manual-ref-variables.rst +13 -0
@@ -39,6 +39,19 @@ overview of their function and contents. when specified allows for the Git binary from the host to be used rather than building ``git-native``. + :term:`AZ_SAS` + Azure Storage Shared Access Signature, when using the + :ref:`Azure Storage fetcher <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>` + This variable can be defined to be used by the fetcher to authenticate + and gain access to non-public artifacts. + :: + + AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"" + + For more information see Microsoft's Azure Storage documentation at + https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview + + :term:`B` The directory in which BitBake executes functions during a recipe's build process.
Signature · 1 line
2.25.1