From 96aae8a31084cab8b42ffe607f3e5e54f9666989 Mon Sep 17 00:00:00 2001 From: Sam Jordan Date: Fri, 29 Oct 2021 11:53:32 +0100 Subject: [PATCH] Fixes logic issues that caused builds to return a code of 0 when they actually failed --- app/Commands/DockerBuildCommand.php | 3 +++ app/Commands/DockerPushCommand.php | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Commands/DockerBuildCommand.php b/app/Commands/DockerBuildCommand.php index 59e718b..8a290e1 100644 --- a/app/Commands/DockerBuildCommand.php +++ b/app/Commands/DockerBuildCommand.php @@ -69,6 +69,9 @@ public function handle() $this->line("Building docker images for all services with tag {$tag}"); if ($this->callBuild($tag)) { return $this->info("Docker images built."); + } else { + $this->error("Docker images failed to build."); + return 1; } } diff --git a/app/Commands/DockerPushCommand.php b/app/Commands/DockerPushCommand.php index 8784d90..0f72e28 100644 --- a/app/Commands/DockerPushCommand.php +++ b/app/Commands/DockerPushCommand.php @@ -65,7 +65,10 @@ public function handle() if (count($services) == 0) { // Generic full file build as we have no services $this->line("Pushing docker images for all services with tags " . implode(', ', $tags)); - $this->callPush($tags); + if (!$this->callPush($tags)) { + $this->error("Unable to push images."); + return 1; + } } else { // We've been provided services, we'll run the command for each $this->line(sprintf( @@ -89,7 +92,7 @@ protected function callPush(array $tags, string $service = null): bool // We need to make the new tags first $sourceTag = $this->helpers->docker()->prefixedTag(); if (!$this->helpers->docker()->tagImages($service, $sourceTag, $tags)) { - return 1; + return false; } foreach ($tags as $tag) {