Compare commits
3 commits
0952ec57a8
...
074e77196e
Author | SHA1 | Date | |
---|---|---|---|
074e77196e | |||
88253f49ac | |||
2fc59f105b |
7 changed files with 39 additions and 4 deletions
1
build.py
1
build.py
|
@ -176,6 +176,7 @@ def prepare(project):
|
|||
def tag(project):
|
||||
build = get_devops_build(project)
|
||||
build.tag_bump_and_push_release()
|
||||
#TODO: build.publish_artifacts()
|
||||
|
||||
|
||||
def release(project):
|
||||
|
|
|
@ -1,18 +1,25 @@
|
|||
from typing import List
|
||||
from pathlib import Path
|
||||
from ..infrastructure import GitApi, BuildFileRepository
|
||||
from ..infrastructure import GitApi, ArtifactDeploymentApi, BuildFileRepository
|
||||
from ..domain import Version, Release, ReleaseType
|
||||
|
||||
|
||||
class ReleaseService:
|
||||
def __init__(self, git_api: GitApi, build_file_repository: BuildFileRepository):
|
||||
def __init__(
|
||||
self,
|
||||
git_api: GitApi,
|
||||
build_file_repository: BuildFileRepository,
|
||||
artifact_deployment_api: ArtifactDeploymentApi,
|
||||
):
|
||||
self.git_api = git_api
|
||||
self.artifact_deployment_api = artifact_deployment_api
|
||||
self.build_file_repository = build_file_repository
|
||||
|
||||
@classmethod
|
||||
def prod(cls, base_dir: str):
|
||||
return cls(
|
||||
GitApi(),
|
||||
ArtifactDeploymentApi(),
|
||||
BuildFileRepository(base_dir),
|
||||
)
|
||||
|
||||
|
@ -53,6 +60,12 @@ class ReleaseService:
|
|||
)
|
||||
self.git_api.push_follow_tags()
|
||||
|
||||
def publish_artifacts(self, release: Release):
|
||||
self.artifact_deployment_api.calculate_checksums(artifact_path=)
|
||||
# create release
|
||||
# add artifacts to release
|
||||
pass
|
||||
|
||||
def __set_version_and_commit__(
|
||||
self, version: Version, build_file_ids: List[str], message: str
|
||||
):
|
||||
|
|
|
@ -7,5 +7,6 @@ from .infrastructure import (
|
|||
CredentialsApi,
|
||||
GitApi,
|
||||
TerraformApi,
|
||||
ArtifactDeploymentApi,
|
||||
)
|
||||
from .repository import DevopsRepository, BuildFileRepository
|
||||
|
|
|
@ -231,6 +231,6 @@ class ArtifactDeploymentApi:
|
|||
+ '-H "Content-Type: multipart/form-data" '
|
||||
+ f'-F "attachment=@{attachment};type={attachment_type}"')
|
||||
|
||||
def calculate_checksums(self, build_path: str):
|
||||
def calculate_checksums(self, artifact_path: str):
|
||||
self.execution_api.execute(f"find {build_path} -type f -exec sha256sum {{}}; | sort > {build_path} sha256sum.lst")
|
||||
self.execution_api.execute(f"find {build_path} -type f -exec sha512sum {{}}; | sort > {build_path} sha512sum.lst")
|
||||
|
|
|
@ -26,3 +26,8 @@ class ReleaseMixin(DevopsBuild):
|
|||
devops = self.devops_repo.get_devops(self.project)
|
||||
release = devops.mixins[MixinType.RELEASE]
|
||||
self.release_service.tag_bump_and_push_release(release)
|
||||
|
||||
def publish_artifacts(self):
|
||||
devops = self.devops_repo.get_devops(self.project)
|
||||
release = devops.mixins[MixinType.RELEASE]
|
||||
self.release_service.publish_artifacts(release)
|
||||
|
|
|
@ -7,12 +7,13 @@ from src.main.python.ddadevops.domain import (
|
|||
from src.test.python.domain.helper import (
|
||||
BuildFileRepositoryMock,
|
||||
GitApiMock,
|
||||
ArtifactDeploymentApiMock,
|
||||
build_devops,
|
||||
)
|
||||
from src.main.python.ddadevops.application import ReleaseService
|
||||
|
||||
def test_sould_update_release_type():
|
||||
sut = ReleaseService(GitApiMock(), BuildFileRepositoryMock("build.py"))
|
||||
sut = ReleaseService(GitApiMock(), ArtifactDeploymentApiMock(), BuildFileRepositoryMock("build.py"))
|
||||
devops = build_devops({})
|
||||
release = devops.mixins[MixinType.RELEASE]
|
||||
sut.update_release_type(release, "MAJOR")
|
||||
|
|
|
@ -150,3 +150,17 @@ class GitApiMock:
|
|||
|
||||
def checkout(self, branch: str):
|
||||
pass
|
||||
|
||||
|
||||
class ArtifactDeploymentApiMock:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def post_release(self, target_url: str, tag: str, token: str):
|
||||
pass
|
||||
|
||||
def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str):
|
||||
pass
|
||||
|
||||
def calculate_checksums(self, build_path: str):
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue