mafw.devtools.gitlab.docs_registry
Documentation-specific GitLab Generic Package Registry operations.
This module wraps the generic GitLab registry helpers with MAFw-docs-specific defaults (package name, filename conventions).
Functions
Download a documentation zip archive from the GitLab Generic Package Registry. |
|
|
List generic packages for mafw-docs in the GitLab Package Registry. |
Resolve package IDs for mafw-docs generic packages by version. |
|
Upload a documentation zip archive to the GitLab Generic Package Registry. |
- mafw.devtools.gitlab.docs_registry.download_docs_zip_from_gitlab_generic_registry(api_config: GitlabAPIConfiguration, package_version: str, download_dir: Path, package_name: str = 'mafw-docs', file_name: str | None = None, timeout_s: float = 60.0) Path | None[source]
Download a documentation zip archive from the GitLab Generic Package Registry.
The equivalent GitLab API endpoint is:
GET /projects/:id/packages/generic/:package_name/:package_version/:file_nameThe function first issues a HEAD request to determine if the file exists: - 404: the package file does not exist (cache miss) and
Noneis returned. - 200: the file exists and is downloaded. - otherwise: a warning is printed andNoneis returned.Authentication headers: -
JOB-TOKENwhen running on CI (api_config.on_ciis True) -PRIVATE-TOKENfor local execution- Parameters:
api_config (gitlab.GitlabAPIConfiguration) – GitLab API configuration
package_version (str) – Package version (typically the git tag, e.g.
v2.1.0)download_dir (Path) – Directory where the downloaded zip is stored
package_name (str) – Generic package name, defaults to
mafw-docsfile_name (str | None) – File name to retrieve, defaults to
mafw-docs-<version>.ziptimeout_s (float) – Request timeout in seconds, defaults to 60.0
- Returns:
Path to the downloaded zip archive, or None if it does not exist or cannot be retrieved
- Return type:
Path | None
- mafw.devtools.gitlab.docs_registry.list_mafw_docs_generic_packages(api_config: GitlabAPIConfiguration, package_name: str = 'mafw-docs') list[dict[str, Any]][source]
List generic packages for mafw-docs in the GitLab Package Registry.
Uses the Packages API:
GET /projects/:id/packagesand filters forpackage_type=genericand exactname == package_name.- Parameters:
api_config (gitlab.GitlabAPIConfiguration) – GitLab API configuration
package_name (str) – Package name, defaults to
mafw-docs
- Returns:
List of package dictionaries from the API
- Return type:
list[dict[str, Any]]
- mafw.devtools.gitlab.docs_registry.resolve_mafw_docs_package_ids_by_version(api_config: GitlabAPIConfiguration, package_name: str = 'mafw-docs') dict[str, int][source]
Resolve package IDs for mafw-docs generic packages by version.
- Parameters:
api_config (gitlab.GitlabAPIConfiguration) – GitLab API configuration
package_name (str) – Package name, defaults to
mafw-docs
- Returns:
Mapping from version string to package id
- Return type:
dict[str, int]
- mafw.devtools.gitlab.docs_registry.upload_docs_zip_to_gitlab_generic_registry(api_config: GitlabAPIConfiguration, package_version: str, zip_path: Path, package_name: str = 'mafw-docs', timeout_s: float = 60.0) bool[source]
Upload a documentation zip archive to the GitLab Generic Package Registry.
The equivalent GitLab API endpoint is:
PUT /projects/:id/packages/generic/:package_name/:package_version/:file_nameAuthentication headers: -
JOB-TOKENwhen running on CI (api_config.on_ciis True) -PRIVATE-TOKENfor local execution- Parameters:
api_config (gitlab.GitlabAPIConfiguration) – GitLab API configuration
package_version (str) – Package version (typically the git tag, e.g.
v2.1.0)zip_path (Path) – Path to the zip file to upload
package_name (str) – Generic package name, defaults to
mafw-docstimeout_s (float) – Request timeout in seconds, defaults to 60.0
- Returns:
True if the file was uploaded, False if the upload was skipped because the target already exists
- Return type:
bool
- Raises:
FileNotFoundError – If
zip_pathdoes not existRuntimeError – If the upload fails (non-2xx response)