ClickHouse/ci/praktika/artifact.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1023 B
Python
Raw Normal View History

2024-11-15 11:32:48 +00:00
import copy
2024-10-01 19:19:35 +00:00
from dataclasses import dataclass
class Artifact:
class Type:
GH = "github"
S3 = "s3"
PHONY = "phony"
@dataclass
class Config:
"""
name - artifact name
type - artifact type, see Artifact.Type
path - file path or glob, e.g. "path/**/[abc]rtifac?/*"
"""
name: str
type: str
path: str
_provided_by: str = ""
_s3_path: str = ""
def is_s3_artifact(self):
return self.type == Artifact.Type.S3
2024-11-15 11:32:48 +00:00
def parametrize(self, names):
res = []
for name in names:
obj = copy.deepcopy(self)
obj.name = name
res.append(obj)
return res
2024-10-01 19:19:35 +00:00
@classmethod
def define_artifact(cls, name, type, path):
return cls.Config(name=name, type=type, path=path)
@classmethod
def define_gh_artifact(cls, name, path):
return cls.define_artifact(name=name, type=cls.Type.GH, path=path)