From dc6cd091fe8b3bc63341cda8749802e770ccb36b Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Tue, 13 Apr 2021 14:30:54 +0200
Subject: [PATCH] Rework hack to make sure images are tagged as latest

Commit 788aa27aef91 "Debian commits" was introduced to base images
directly on Debian while the Bullseye import in v2022dev2 is not
complete enought to real Apertis build images.

Unfortunately it broke the ability to tag images as `latest`.

Rework the hack so tagging works again.

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 .gitlab-ci.yml | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd0ce00..05bc514 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,9 +6,8 @@ stages:
   - publish images
 
 variables:
-  RELEASE: "bullseye"
-  CUSTREL: "v2022dev2"
-  DISTRO: debian
+  RELEASE: "v2022dev2"
+  DISTRO: apertis
   MIRROR: https://deb.debian.org/debian/
   STABLE: auto
   TEST_TAG: test-${CI_PIPELINE_ID}
@@ -58,6 +57,8 @@ build-base-rootfs:
   only:
     - branches
   script:
+    - DISTRO=debian RELEASE=bullseye
+    - echo "Hack DISTRO=$DISTRO and RELEASE=$RELEASE until we can build real Apertis v2022dev2 images"
     - >
       cd base &&
       debos -t osname:${DISTRO} -t suite:${RELEASE} -t stable:$STABLE  -t mirror:"$MIRROR" rootfs.yaml
@@ -75,13 +76,13 @@ build-base-rootfs:
       /kaniko/executor
       --context $CI_PROJECT_DIR/$image
       --dockerfile $CI_PROJECT_DIR/$image/Dockerfile
-      --destination $CI_REGISTRY_IMAGE/$CUSTREL-$image:$TEST_TAG
+      --destination $CI_REGISTRY_IMAGE/$RELEASE-$image:$TEST_TAG
       --build-arg OSNAME=$DISTRO
-      --build-arg RELEASE=$CUSTREL
+      --build-arg RELEASE=$RELEASE
       --build-arg TAG=$TEST_TAG
       --build-arg REGISTRY=$CI_REGISTRY_IMAGE
       --single-snapshot
-    - echo Pushed $CI_REGISTRY_IMAGE/$CUSTREL-$image:$TEST_TAG.
+    - echo Pushed $CI_REGISTRY_IMAGE/$RELEASE-$image:$TEST_TAG.
 
 .publish-docker-image:
   image: buildah/buildah
@@ -89,7 +90,7 @@ build-base-rootfs:
     - lightweight
   variables:
     AUTH: $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
-    IMAGE: ${CI_REGISTRY_IMAGE}/${CUSTREL}-${image}
+    IMAGE: ${CI_REGISTRY_IMAGE}/${RELEASE}-${image}
   script:
     - echo "Tagging ${TEST_TAG} as ${TAG} for ${IMAGE}"
     - skopeo copy --src-creds "$AUTH" --dest-creds "$AUTH" docker://"${IMAGE}:${TEST_TAG}" docker://"${IMAGE}:${TAG}"
@@ -119,7 +120,7 @@ test-package-source-builder:
   needs:
     - build-package-source-builder-docker-image
   image:
-    name: $CI_REGISTRY_IMAGE/${CUSTREL}-package-source-builder:${TEST_TAG}
+    name: $CI_REGISTRY_IMAGE/${RELEASE}-package-source-builder:${TEST_TAG}
     entrypoint: [ "" ]
   script:
     - git clone https://gitlab.apertis.org/infrastructure/test-data/fixture-dash-non-updated
-- 
GitLab