remove no longer neede artifact deployment
This commit is contained in:
parent
7aa45910e9
commit
f9daf87262
3 changed files with 0 additions and 128 deletions
|
@ -1,27 +0,0 @@
|
|||
from ..infrastructure import GitApi, ArtifactDeploymentApi
|
||||
from ..domain import Credentials
|
||||
|
||||
# This will be moved to release mixin
|
||||
class ArtifactDeploymentService:
|
||||
def __init__(self, git_api: GitApi, artifact_deployment_api: ArtifactDeploymentApi):
|
||||
self.git_api = git_api
|
||||
self.artifact_deployment_api = artifact_deployment_api
|
||||
|
||||
@classmethod
|
||||
def prod(cls):
|
||||
return cls(
|
||||
GitApi(),
|
||||
ArtifactDeploymentApi(),
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
# ToDo: Update release Id as in release_mixin_services.py
|
|
@ -1,61 +0,0 @@
|
|||
from pybuilder.core import Project
|
||||
from .devops_build import DevopsBuild
|
||||
from .domain import MixinType
|
||||
|
||||
# """
|
||||
# Functional Req:
|
||||
|
||||
# General process for deploying prebuilt (meissa) binaries to our own repo server.
|
||||
|
||||
# [-1]
|
||||
# Building is handled by other entities
|
||||
# is another pybuilder task
|
||||
# the binary is reachable with devops.build_path()
|
||||
# we might need to establish a "build" that does lein builds for us
|
||||
# we might need to establish a "build" that does gradlew build for us
|
||||
# same for all other projects that produce binaries
|
||||
# currently the c4k_build.py just creates the auth and config yamls
|
||||
|
||||
# [0]
|
||||
# get artifact deployment url
|
||||
# Base url: https://repo.prod.meissa.de/api/v1/repos/
|
||||
# Changeable: /meissa/provs/
|
||||
# persitent suffix to url: releases
|
||||
# name is accessible from input
|
||||
|
||||
# [1]
|
||||
# get release token
|
||||
# could be an api token for repo.prod.meissa.de
|
||||
# credential mapping as described in the docs
|
||||
|
||||
# [2]
|
||||
# get release tag
|
||||
# is the version of the project
|
||||
# get from gitApi
|
||||
|
||||
# [3]
|
||||
# post a json message containting [2] to [0], watching stdout for answers
|
||||
# authorized by [1]
|
||||
# validate if [3] was successful by reading stdout
|
||||
# or create error message containing ID of release
|
||||
|
||||
# [4]
|
||||
# get release-id from stdout of [3]
|
||||
# print release-id
|
||||
|
||||
# [5]
|
||||
# generate sha256 sums & generate sha512 sums of results of [-1]
|
||||
|
||||
# [6]
|
||||
# push results of [-1] & [5] to [0]/[4]/assets
|
||||
|
||||
# """
|
||||
|
||||
# This will be moved to release mixin
|
||||
class ArtifactDeploymentMixin(DevopsBuild):
|
||||
def __init__(self, project: Project, inp: dict):
|
||||
super().__init__(project, inp)
|
||||
devops = self.devops_repo.get_devops(self.project)
|
||||
if MixinType.ARTIFACT_DEPLOYMENT not in devops.mixins: # TODO: Check for Release mixin as well
|
||||
raise ValueError("ArtifactDeploymentMixin requires MixinType.ARTIFACT_DEPLOYMENT")
|
||||
self.base_url = 'https://repo.prod.meissa.de/api/v1/repos/'
|
|
@ -1,40 +0,0 @@
|
|||
from typing import List, Dict, Optional
|
||||
from .common import (
|
||||
Validateable,
|
||||
CredentialMappingDefault,
|
||||
DnsRecord,
|
||||
Devops,
|
||||
)
|
||||
|
||||
# This will be moved to release mixin
|
||||
class ArtifactDeployment(Validateable, CredentialMappingDefault):
|
||||
def __init__(self, inp: dict):
|
||||
self.name = inp.get("name")
|
||||
self.artifact_base_url = inp.get("artifact_base_url")
|
||||
self.organization = inp.get("organization")
|
||||
|
||||
def get_artifact_release_url(self) -> str:
|
||||
return f"{self.artifact_base_url}/{self.organization}/{self.name}/releases"
|
||||
|
||||
def get_artifact_asset_url(self, release_id: str) -> str:
|
||||
return f"{self.get_artifact_release_url}/{release_id}/assets"
|
||||
|
||||
def update_runtime_config(self, dns_record: DnsRecord):
|
||||
self.dns_record = dns_record
|
||||
self.throw_if_invalid()
|
||||
|
||||
def validate(self) -> List[str]:
|
||||
result = []
|
||||
result += self.__validate_is_not_empty__("name")
|
||||
result += self.__validate_is_not_empty__("artifact_base_url")
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def get_mapping_default(cls) -> List[Dict[str, str]]:
|
||||
return [ # ToDo: Adapt for token
|
||||
{
|
||||
"gopass_path": "server/meissa/grafana-cloud",
|
||||
"gopass_field": "grafana-cloud-user",
|
||||
"name": "c4k_grafana_cloud_user",
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue