Add skeleton for ArtifactDeploymentService
This commit is contained in:
parent
c02440ac65
commit
f3bf8cb335
1 changed files with 17 additions and 5 deletions
|
@ -1,15 +1,27 @@
|
||||||
from ..infrastructure import GitApi
|
from ..infrastructure import GitApi, ArtifactDeploymentApi
|
||||||
|
from ..domain import Credentials
|
||||||
|
|
||||||
class ArtifactDeploymentService:
|
class ArtifactDeploymentService:
|
||||||
def __init__(self, git_api: GitApi):
|
def __init__(self, git_api: GitApi, artifact_deployment_api: ArtifactDeploymentApi):
|
||||||
self.git_api = git_api
|
self.git_api = git_api
|
||||||
|
self.artifact_deployment_api = artifact_deployment_api
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def prod(cls):
|
def prod(cls):
|
||||||
return cls(
|
return cls(
|
||||||
GitApi(),
|
GitApi(),
|
||||||
|
ArtifactDeploymentApi(),
|
||||||
)
|
)
|
||||||
|
|
||||||
# def __get_base_artifact_release_url(self, base_url: str, organization: str, name: str) -> str:
|
def __get_base_artifact_release_url(self, base_url: str, organization: str, name: str) -> str:
|
||||||
# return f"{base_url}/{organization}/{name}/releases"
|
return f"{base_url}/{organization}/{name}/releases"
|
||||||
|
|
||||||
|
def post_release(self, target_url: str, tag: str, credentials: Credentials):
|
||||||
|
response = self.artifact_deployment_api.post_release(target_url, tag, credentials.mappings["token"])
|
||||||
|
# Get release id from response
|
||||||
|
|
||||||
|
def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str):
|
||||||
|
self.artifact_deployment_api.post_asset(target_url, release_id, attachment, attachment_type, token)
|
||||||
|
|
||||||
|
def calculate_checksums(self, build_path: str):
|
||||||
|
self.artifact_deployment_api.calculate_checksums(build_path)
|
||||||
|
|
Loading…
Reference in a new issue