Files
bec_shared_actions/checkout_repositories/run_ci.sh

64 lines
1.9 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
echo " Received input parameters: $* "
PLUGIN_URL="https://gitea.psi.ch/bec/$1.git"
PLUGIN_BRANCH="$2"
CORE_BRANCH="$3"
WIDGETS_BRANCH="$4"
OPHYD_DEVICES_BRANCH="$5"
echo "--- Repository checkouts begin ---"
# --- Step 1: Checkout Plugin ---
echo "=== Checkout BEC Plugin ==="
mkdir -p ./_plugin_checkout_/
cd ./_plugin_checkout_/
if git clone --depth 1 --branch "$PLUGIN_BRANCH" "$PLUGIN_URL" plugin_repo; then
echo "Plugin checkout successful"
else
echo "Plugin checkout failed, trying default branch"
git clone --depth 1 "$PLUGIN_URL" plugin_repo
fi
cd ..
# --- Step 2: Checkout Core ---
echo "=== Checkout BEC Core ==="
mkdir -p ./_bec_checkout_/
cd ./_bec_checkout_/
if git clone --depth 1 --branch "$CORE_BRANCH" https://github.com/bec-project/bec.git bec_core; then
echo "Core checkout successful"
else
echo "Core checkout failed, trying default branch"
git clone --depth 1 https://github.com/bec-project/bec.git bec_core
fi
cd ..
# --- Step 3: Checkout Widgets ---
echo "=== Checkout BEC Widgets ==="
mkdir -p ./_bec_widgets_checkout_/
cd ./_bec_widgets_checkout_/
if git clone --depth 1 --branch "$WIDGETS_BRANCH" https://github.com/bec-project/bec_widgets.git bec_widgets; then
echo "Widgets checkout successful"
else
echo "Widgets checkout failed, trying default branch"
git clone --depth 1 https://github.com/bec-project/bec_widgets.git bec_widgets
fi
cd ..
# --- Step 4: Checkout Ophyd Devices ---
echo "=== Checkout Ophyd Devices ==="
mkdir -p ./_ophyd_devices_checkout_/
cd ./_ophyd_devices_checkout_/
if git clone --depth 1 --branch "$OPHYD_DEVICES_BRANCH" https://github.com/bec-project/ophyd_devices.git bec_ophyd_devices; then
echo "Ophyd Devices checkout successful"
else
echo "Ophyd Devices checkout failed, trying default branch"
git clone --depth 1 https://github.com/bec-project/ophyd_devices.git bec_ophyd_devices
fi
cd ..
echo "--- All checkouts complete ---"