From 7de952d87fee634025979da61ee076dc14fcc8b6 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wouter.deconinck@umanitoba.ca>
Date: Tue, 10 Aug 2021 23:26:42 +0000
Subject: [PATCH] Get calibrations through script instead of CI only

---
 .gitlab-ci.yml       | 2 +-
 bin/get_calibrations | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 bin/get_calibrations

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 25014331..778360b7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -58,7 +58,7 @@ common:detector:
     - ln -s "${LOCAL_DATA_PATH}/sim_output" sim_output
     - ln -s "${LOCAL_DATA_PATH}/datasets/data" data
     - ls -lrtha
-    - curl -sL https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks/-/jobs/artifacts/master/raw/results/emcal_barrel_calibration.json?job=collect_results:barrel_ecal --output config/emcal_barrel_calibration.json
+    - bash bin/get_calibrations
   interruptible: true
 
 include: 
diff --git a/bin/get_calibrations b/bin/get_calibrations
new file mode 100644
index 00000000..57389c8e
--- /dev/null
+++ b/bin/get_calibrations
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+branch=${1:-master}
+detector_benchmarks=https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks/-/jobs/artifacts/${branch}/raw/
+
+mkdir -p config
+for i in results/emcal_barrel_calibration.json ; do
+  curl --fail -sL ${detector_benchmarks}/${i}?job=deploy_results --output config/$(basename ${i})
+done
-- 
GitLab