From 9e0b3de8ee274186a70eb398841af5cfe0221671 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Fri, 17 Nov 2023 02:50:50 +0100
Subject: [PATCH] ci(earthly): Make docker login optional

---
 images/.utils/gitlab-earthly.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/images/.utils/gitlab-earthly.yaml b/images/.utils/gitlab-earthly.yaml
index c8dc5b1fa..691199177 100644
--- a/images/.utils/gitlab-earthly.yaml
+++ b/images/.utils/gitlab-earthly.yaml
@@ -14,6 +14,11 @@
       - earthly config global.disable_log_sharing true
       - earthly account logout
       - earthly bootstrap
-      - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+      - |
+        if [ -n "$CI_REGISTRY" ] && [ -n "$CI_REGISTRY_USER" ] && [ -n "$CI_REGISTRY_PASSWORD" ]; then
+          docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+        else
+          echo "Missing variable. Skipping docker login!"
+        fi
   tags:
     - privileged
\ No newline at end of file
-- 
GitLab