Skip to content
Snippets Groups Projects
Commit 014c9eae authored by Adrian Ciu's avatar Adrian Ciu
Browse files

added tls_verify attribute in BuildCacheManager

parent f445e82d
No related branches found
No related tags found
No related merge requests found
Pipeline #60588 passed with stages
in 43 minutes and 55 seconds
...@@ -15,8 +15,7 @@ class BuildCacheManager(BuildCacheManagerInterface): ...@@ -15,8 +15,7 @@ class BuildCacheManager(BuildCacheManagerInterface):
""" """
def __init__(self, registry_host, registry_project, registry_username, registry_password, cache_version='cache', def __init__(self, registry_host, registry_project, registry_username, registry_password, cache_version='cache',
auth_backend='basic', auth_backend='basic', insecure=False, tls_verify=True):
insecure=False):
self._logger = get_logger(__name__, BuildCacheManager.__name__) self._logger = get_logger(__name__, BuildCacheManager.__name__)
self._registry_project = registry_project self._registry_project = registry_project
...@@ -29,7 +28,7 @@ class BuildCacheManager(BuildCacheManagerInterface): ...@@ -29,7 +28,7 @@ class BuildCacheManager(BuildCacheManagerInterface):
# Refer to the official OCI Registry documentation for detailed information on the available authentication methods. # Refer to the official OCI Registry documentation for detailed information on the available authentication methods.
# Supported authentication types may include basic authentication (username/password), token-based authentication, # Supported authentication types may include basic authentication (username/password), token-based authentication,
self._client = oras.client.OrasClient(hostname=self._registry_host, auth_backend=auth_backend, self._client = oras.client.OrasClient(hostname=self._registry_host, auth_backend=auth_backend,
insecure=insecure) insecure=insecure, tls_verify=tls_verify)
self._client.login(username=self._registry_username, password=self._registry_password) self._client.login(username=self._registry_username, password=self._registry_password)
self.cache_version = cache_version self.cache_version = cache_version
self._oci_registry_path = f'{self._registry_host}/{self._registry_project}/{self.cache_version}' self._oci_registry_path = f'{self._registry_host}/{self._registry_project}/{self.cache_version}'
...@@ -53,7 +52,7 @@ class BuildCacheManager(BuildCacheManagerInterface): ...@@ -53,7 +52,7 @@ class BuildCacheManager(BuildCacheManagerInterface):
tag = str(sub_path.name) tag = str(sub_path.name)
rel_path = str(sub_path.relative_to(build_cache_path)).replace(tag, "") rel_path = str(sub_path.relative_to(build_cache_path)).replace(tag, "")
target = f"{self._registry_host}/{self._registry_project}/{self.cache_version}:{tag}" target = f"{self._registry_host}/{self._registry_project}/{self.cache_version}:{tag}"
upload_file = True upload_file = True
if update_cache is False and tag in tags: if update_cache is False and tag in tags:
upload_file = False upload_file = False
if upload_file: if upload_file:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment