From d80a638c3c3d251523362ab2118bcab60e65bb23 Mon Sep 17 00:00:00 2001
From: Dmitry Rodionov <d.rodionov@picodata.io>
Date: Fri, 2 Feb 2024 13:15:59 +0300
Subject: [PATCH] chore(ci): fetch picodata tags too, tweak test-helm-docker

When using git describe fetch depth for shallow clones needs to be deep
enough to reach exiting tag. We used to only deepen our submodules for
tarantool build but now we reached the same problem for picodata. So
fetch tags for it as well.

allow_failure in test-helm-docker-image makes CI properly fail and
prevent merges when there are failures. Without it it didnt go past
"manual action required" icon and allowed to merge CI without fixing
other test jobs
---
 .gitlab-ci.yml | 3 ++-
 build.rs       | 9 +++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 75e7943715..cd5fb2f3be 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -114,7 +114,7 @@ build-base-image:
     - &fetch-tags |
       # Fetch tags
       ci-log-section start "fetch-submodule-tags" Fetching tags for submodules
-      for s in tarantool-sys tarantool-sys/third_party/luajit; do
+      for s in . tarantool-sys tarantool-sys/third_party/luajit; do
         echo "Fetching tag for $s"
         pushd $s
         until git describe; do git fetch --deepen 100; done
@@ -268,6 +268,7 @@ test-helm-docker-image:
     - if: $CI_COMMIT_BRANCH == $MAIN_BRANCH
       when: on_success
     - when: manual
+      allow_failure: true
   variables:
     GIT_DEPTH: 100
     GIT_STRATEGY: fetch
diff --git a/build.rs b/build.rs
index c086c83c1b..cedf78e5c7 100644
--- a/build.rs
+++ b/build.rs
@@ -78,8 +78,13 @@ fn set_git_describe_env_var() {
     }
 
     let output = Command::new("git").arg("describe").output().unwrap();
-    assert!(output.status.success());
-    let git_describe = String::from_utf8(output.stdout).unwrap();
+    assert!(
+        output.status.success(),
+        "stdout: {} stderr: {}",
+        String::from_utf8_lossy(&output.stdout),
+        String::from_utf8_lossy(&output.stderr),
+    );
+    let git_describe = std::str::from_utf8(&output.stdout).unwrap();
     println!("cargo:rustc-env=GIT_DESCRIBE={git_describe}");
 }
 
-- 
GitLab