Skip to content
Snippets Groups Projects
Commit 26ccb698 authored by gyulaid's avatar gyulaid
Browse files

Close #30

Added upload + tagging
parent bfb997ae
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,15 @@ class Tagger:
}
return f"{data}"
def handle(self, client, image):
if self.name is not None:
if self.name not in image.tags and f"{self.name}:latest" not in image.tags:
print(f"[DockerRunner] Tagging {image.tags[0]} as {self.name}")
image.tag(self.name)
if self.publish:
print(f"[DockerRunner] Pushing {self.name}")
client.push(self.name)
class Builder():
def __init__(self, config) -> None:
......@@ -202,6 +211,7 @@ class DockerRunner():
def run(self, job_spec):
job_config = self.config.copy(job_spec)
logging.debug(f"[DockerRunner] Job config: {job_config.__str__()}")
if job_config.image_provider is None:
raise RunnerError("[DockerRunner] No image provider configured!")
image = job_config.image_provider.prepare(self.client)
......@@ -227,3 +237,5 @@ class DockerRunner():
finally:
if container is not None:
container.stop()
job_config.tagger.handle(self.client, image)
......@@ -79,8 +79,8 @@ jobs:
- date
- env
tag:
publish: true
name: published name with repo and everything
publish: false
name: repo.example.com/test/na
credentials:
username: B
password: B
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment