From 1a6a56f108f23d9ed3163b094efa71eaed9d5d87 Mon Sep 17 00:00:00 2001
From: Konrad Botor <kbotor@syncad.com>
Date: Tue, 25 Jul 2023 10:22:05 +0200
Subject: [PATCH] Updated Emscripten CI build to additionally tag it with
 commit SHA - ref. !12

---
 README.md                                        | 2 +-
 docker-bake.hcl                                  | 2 +-
 scripts/bash/build_emscripten_image.sh           | 4 ++--
 scripts/bash/emscripten/prepare_boost.sh         | 4 ++++
 scripts/bash/emscripten/prepare_openssl.sh       | 3 +++
 scripts/bash/emscripten/prepare_secp256k1-zkp.sh | 4 ++++
 6 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 84a492b..dc0edf5 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ This project contains the common CI templates and scripts for Hive and Hive-rela
 
 - misc - miscellaneous files
 - scripts/bash - Bash scripts
-- scripts/emscripten - source for emsdk image
+- scripts/bash/emscripten - source for emsdk image
 - scripts/python - Python scripts
 - templates - GitLab CI templates
 
diff --git a/docker-bake.hcl b/docker-bake.hcl
index 5ff8299..320dec0 100644
--- a/docker-bake.hcl
+++ b/docker-bake.hcl
@@ -77,7 +77,7 @@ target "tox-test-runner" {
 
 target "emsdk" {
   dockerfile = "Dockerfile.emscripten"
-  tags = [ notempty(CI_REGISTRY_IMAGE) ? "${CI_REGISTRY_IMAGE}/emsdk:${EMSCRIPTEN_VERSION}" : "emsdk:${EMSCRIPTEN_VERSION}" ]
+  tags = generate-tags("emsdk", "${EMSCRIPTEN_VERSION}")
   cache-from = generate-cache-from("emsdk", "${EMSCRIPTEN_VERSION}")
   cache-to = generate-cache-to("emsdk", "${EMSCRIPTEN_VERSION}")
   args = {
diff --git a/scripts/bash/build_emscripten_image.sh b/scripts/bash/build_emscripten_image.sh
index 6487e33..e9fd356 100755
--- a/scripts/bash/build_emscripten_image.sh
+++ b/scripts/bash/build_emscripten_image.sh
@@ -11,5 +11,5 @@ export DOCKER_BUILDKIT=1
 
 docker build --target=emscripten_builder \
   --build-arg "EMSCRIPTEN_VERSION=${EMSDK_VERSION}" \
-  -t "${REGISTRY}emsdk:3.1.43" \
-  -f "${SRCDIR}/Dockerfile.emscripten" "${SRCDIR}"
+  --tag "${REGISTRY}emsdk:3.1.43" \
+  --file "${SRCDIR}/Dockerfile.emscripten" "${SRCDIR}"
diff --git a/scripts/bash/emscripten/prepare_boost.sh b/scripts/bash/emscripten/prepare_boost.sh
index 2642c18..3766961 100755
--- a/scripts/bash/emscripten/prepare_boost.sh
+++ b/scripts/bash/emscripten/prepare_boost.sh
@@ -1,5 +1,7 @@
 #! /bin/bash
 
+echo "Building Boost..."
+
 set -xeuo pipefail
 
 TMP_SRC=${1:?"Missing arg #1 to specify source temp directory"}
@@ -44,3 +46,5 @@ printf "using clang : emscripten : emcc -s USE_ZLIB=1 -s USE_ICU=0 : <archiver>e
   --with-regex \
   --with-system \
   install
+
+echo "Boost build finished."
\ No newline at end of file
diff --git a/scripts/bash/emscripten/prepare_openssl.sh b/scripts/bash/emscripten/prepare_openssl.sh
index 499c710..c627cb8 100755
--- a/scripts/bash/emscripten/prepare_openssl.sh
+++ b/scripts/bash/emscripten/prepare_openssl.sh
@@ -1,5 +1,7 @@
 #! /bin/bash
 
+echo "Building OpenSSL..."
+
 set -xeuo pipefail
 
 TMP_SRC=${1:?"Missing arg #1 to specify source temp directory"}
@@ -28,3 +30,4 @@ sed -i 's/$(CROSS_COMPILE)//' Makefile
 emmake make -j 8 
 emmake make install
 
+echo "OpenSSL build finished."
\ No newline at end of file
diff --git a/scripts/bash/emscripten/prepare_secp256k1-zkp.sh b/scripts/bash/emscripten/prepare_secp256k1-zkp.sh
index 04c41e0..48db9f0 100755
--- a/scripts/bash/emscripten/prepare_secp256k1-zkp.sh
+++ b/scripts/bash/emscripten/prepare_secp256k1-zkp.sh
@@ -1,5 +1,7 @@
 #! /bin/bash
 
+echo "Building secp256k1-zkp..."
+
 set -xeuo pipefail
 
 TMP_SRC=${1:?"Missing arg #1 to specify source temp directory"}
@@ -26,3 +28,5 @@ emconfigure ./configure --prefix="${INSTALL_PREFIX}" \
   --enable-experimental
 emmake make
 emmake make install
+
+echo "Secp256k1-zkp build finished."
\ No newline at end of file
-- 
GitLab