From dadb531df27ed5f0d3182f451cc7a5d0208f36f2 Mon Sep 17 00:00:00 2001
From: Olga Naidjonoka <olga_naidjonoka@epam.com>
Date: Fri, 22 Dec 2023 00:08:07 +0200
Subject: [PATCH] added release check

---
 .buildkite/scripts/common.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh
index c35a0997..ec7788bb 100755
--- a/.buildkite/scripts/common.sh
+++ b/.buildkite/scripts/common.sh
@@ -139,6 +139,16 @@ tag_Exists() {
   fi
 }
 
+release_exists() {
+  local releases=$(retry 3 curl -s -u ${GITHUB_TOKEN_SECRET}:x-oauth-basic https://api.github.com/repos/elastic/${REPO}/releases)
+  echo ":: RELEASES ::"
+  echo $releases
+
+  if [[ $releases == *"${GOLANG_VERSION}"* ]]; then
+    echo ":: RELEASE EXISTS! ::"
+  fi
+}
+
 check_is_arm() {
   if [[ ${HW_TYPE} == "aarch64" || ${HW_TYPE} == "arm64" ]]; then
     is_arm="-arm"