From 6162dfc169eaea81b07e583bd6a35d26e8efae13 Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Thu, 20 Oct 2022 18:21:58 +0000
Subject: [PATCH] Update README and add a check in download_cmix_binaries.sh

---
 README.md                 | 6 +++---
 download_cmix_binaries.sh | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 28a9164..a99e23d 100644
--- a/README.md
+++ b/README.md
@@ -103,8 +103,8 @@ using these utility scripts can speed up the process.
 ### Additional Set Up
 
 You will need to add a personal access token to your environment vars to download binaries via the
-`download_cmix_binaries.sh`.  You can generate one [here](https://gitlab.com/-/profile/personal_access_tokens),
-giving it the "api" scope.
+`download_cmix_binaries.sh`.  You can generate one [here](https://git.xx.network/-/profile/personal_access_tokens),
+giving it the "api" and "read_repository" scope.
 Please add the following to your `~/.zshrc` or `~/.bash_profile` depending on your shell
 (You could most likely find out what shell you're using by running `echo $0` in the terminal).
 
@@ -135,4 +135,4 @@ servers. However, the information it provides is sometimes useful.
 
 So, if you make changes that break integration and merge the fixes to the
 `master` branch of integration, you ought to also merge the `master` branch
-into the `benchmark` branch so that the benchmarks will continue to function.
\ No newline at end of file
+into the `benchmark` branch so that the benchmarks will continue to function.
diff --git a/download_cmix_binaries.sh b/download_cmix_binaries.sh
index e9a4d39..5573e29 100755
--- a/download_cmix_binaries.sh
+++ b/download_cmix_binaries.sh
@@ -50,6 +50,12 @@ fi
 DEFAULTBRANCH=${DEFAULTBRANCH:="release"}
 if [[ $USEREPO == "d" ]]; then
     REPOS_API=${REPOS_API:="https://git.xx.network/api/v4/projects/elixxir%2F"}
+    BRANCH_URL=${BRANCH_URL:="jobs/artifacts/master/raw/release"}
+    curl -f -L -H "PRIVATE-TOKEN: $GITLAB_ACCESS_TOKEN" -o /dev/null "${REPOS_API}user-discovery-bot/$BRANCH_URL/udb$BIN"
+    if [[ $? != 0 ]]; then
+        echo "Bad GITLAB_ACCESS_TOKEN. You need a https://git.xx.network/-/profile/personal_access_tokens with api and read_repository access."
+        exit -1
+    fi
 else
     REPOS_API=${REPOS_API:="https://elixxir-bins.s3-us-west-1.amazonaws.com"}
 fi
@@ -72,6 +78,7 @@ FBRANCH2=$(echo $FBRANCH | sed 's/feature\///g')
 echo "Checking for binaries at $FBRANCH $FBRANCH2 $DEFAULTBRANCH..."
 echo "(Note: if you forced a branch, that is checked first!)"
 
+
 for BRANCH in $(echo "forcedbranch" $FBRANCH $FBRANCH2 $DEFAULTBRANCH); do
     echo "Attempting downloads from: $BRANCH"
     if [[ $USEREPO == "d" ]]; then
-- 
GitLab