From 810d9f6b675ef4483c5c3b12a3f3077d6529b0d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Tue, 12 Mar 2024 10:48:57 -0300 Subject: [PATCH] core: Dockerfile: Enforce style for git version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- core/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/Dockerfile b/core/Dockerfile index 5f65f76bf1..9669e7a647 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -66,10 +66,15 @@ COPY --from=frontendBuilder /home/pi/frontend/dist /home/pi/frontend ## If the folder exists during the build step, it means we put it here by mistake. RUN [ ! -d "/root/.config" ] +# Ensure that the git describe exists and also is in valid format as well +# The format can be invalid if someone is build BlueOS without a tag as reference ARG GIT_DESCRIBE_TAGS RUN [ -z "$GIT_DESCRIBE_TAGS" ] \ && echo "GIT_DESCRIBE_TAGS argument not provided." \ && echo "Use: --build-arg GIT_DESCRIBE_TAGS=\$(git describe --tags --long --always)" \ + && exit 1 \ + || [[ ! $GIT_DESCRIBE_TAGS =~ -[0-9]+-g[a-f0-9]{8}$ ]] \ + && echo "Invalid format: $GIT_DESCRIBE_TAGS (E.g: --g)" \ && exit 1 || exit 0 # Update blueosrc with the necessary environment variables