summaryrefslogtreecommitdiff
path: root/test/lib/ansible_test/_internal/ci
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/ansible_test/_internal/ci')
-rw-r--r--test/lib/ansible_test/_internal/ci/__init__.py4
-rw-r--r--test/lib/ansible_test/_internal/ci/azp.py3
-rw-r--r--test/lib/ansible_test/_internal/ci/local.py3
3 files changed, 10 insertions, 0 deletions
diff --git a/test/lib/ansible_test/_internal/ci/__init__.py b/test/lib/ansible_test/_internal/ci/__init__.py
index 97e41dae76..cc75a5b63e 100644
--- a/test/lib/ansible_test/_internal/ci/__init__.py
+++ b/test/lib/ansible_test/_internal/ci/__init__.py
@@ -39,6 +39,7 @@ class ChangeDetectionNotSupported(ApplicationError):
class CIProvider(metaclass=abc.ABCMeta):
"""Base class for CI provider plugins."""
+
priority = 500
@staticmethod
@@ -103,6 +104,7 @@ def get_ci_provider() -> CIProvider:
class AuthHelper(metaclass=abc.ABCMeta):
"""Public key based authentication helper for Ansible Core CI."""
+
def sign_request(self, request: dict[str, t.Any]) -> None:
"""Sign the given auth request and make the public key available."""
payload_bytes = to_bytes(json.dumps(request, sort_keys=True))
@@ -141,6 +143,7 @@ class AuthHelper(metaclass=abc.ABCMeta):
class CryptographyAuthHelper(AuthHelper, metaclass=abc.ABCMeta):
"""Cryptography based public key based authentication helper for Ansible Core CI."""
+
def sign_bytes(self, payload_bytes: bytes) -> bytes:
"""Sign the given payload and return the signature, initializing a new key pair if required."""
# import cryptography here to avoid overhead and failures in environments which do not use/provide it
@@ -186,6 +189,7 @@ class CryptographyAuthHelper(AuthHelper, metaclass=abc.ABCMeta):
class OpenSSLAuthHelper(AuthHelper, metaclass=abc.ABCMeta):
"""OpenSSL based public key based authentication helper for Ansible Core CI."""
+
def sign_bytes(self, payload_bytes: bytes) -> bytes:
"""Sign the given payload and return the signature, initializing a new key pair if required."""
private_key_pem = self.initialize_private_key()
diff --git a/test/lib/ansible_test/_internal/ci/azp.py b/test/lib/ansible_test/_internal/ci/azp.py
index 9170dfecc8..12e041fa84 100644
--- a/test/lib/ansible_test/_internal/ci/azp.py
+++ b/test/lib/ansible_test/_internal/ci/azp.py
@@ -40,6 +40,7 @@ CODE = 'azp'
class AzurePipelines(CIProvider):
"""CI provider implementation for Azure Pipelines."""
+
def __init__(self) -> None:
self.auth = AzurePipelinesAuthHelper()
@@ -143,6 +144,7 @@ class AzurePipelinesAuthHelper(CryptographyAuthHelper):
Authentication helper for Azure Pipelines.
Based on cryptography since it is provided by the default Azure Pipelines environment.
"""
+
def publish_public_key(self, public_key_pem: str) -> None:
"""Publish the given public key."""
try:
@@ -162,6 +164,7 @@ class AzurePipelinesAuthHelper(CryptographyAuthHelper):
class AzurePipelinesChanges:
"""Change information for an Azure Pipelines build."""
+
def __init__(self, args: CommonConfig) -> None:
self.args = args
self.git = Git()
diff --git a/test/lib/ansible_test/_internal/ci/local.py b/test/lib/ansible_test/_internal/ci/local.py
index ec03194475..fef5435bb2 100644
--- a/test/lib/ansible_test/_internal/ci/local.py
+++ b/test/lib/ansible_test/_internal/ci/local.py
@@ -36,6 +36,7 @@ CODE = '' # not really a CI provider, so use an empty string for the code
class Local(CIProvider):
"""CI provider implementation when not using CI."""
+
priority = 1000
@staticmethod
@@ -149,6 +150,7 @@ class Local(CIProvider):
class InvalidBranch(ApplicationError):
"""Exception for invalid branch specification."""
+
def __init__(self, branch: str, reason: str) -> None:
message = 'Invalid branch: %s\n%s' % (branch, reason)
@@ -159,6 +161,7 @@ class InvalidBranch(ApplicationError):
class LocalChanges:
"""Change information for local work."""
+
def __init__(self, args: TestConfig) -> None:
self.args = args
self.git = Git()