diff --git a/alice-ci/src/alice/runners/dockerrunner.py b/alice-ci/src/alice/runners/dockerrunner.py index faf80a0..7383f7f 100644 --- a/alice-ci/src/alice/runners/dockerrunner.py +++ b/alice-ci/src/alice/runners/dockerrunner.py @@ -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) diff --git a/ci-examples/full.yaml b/ci-examples/full.yaml index a4f24f9..0e5714f 100644 --- a/ci-examples/full.yaml +++ b/ci-examples/full.yaml @@ -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