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

Close #30

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