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