diff --git a/.gitea/scripts/common.sh b/.gitea/scripts/common.sh index 387a396..aba3c89 100644 --- a/.gitea/scripts/common.sh +++ b/.gitea/scripts/common.sh @@ -44,3 +44,23 @@ init_service_env() { # Host running shellbox, i.e. the host the ioc itself runs on IOC_HOST=sls-vserv-bd-01${AGEBD_ENV_SUFFIX_LOWER} } + +# Sets up EPICS_CA_ADDR_LIST so caget/caput/etc. can actually reach IOCs from +# this non-interactive shell (the gitea runner, like a systemd --user unit, +# doesn't inherit an interactive login shell's environment). +# +# cas_12_epics.sh can only fall back to the CA gateway when its broadcast-address +# auto-detection fails (e.g. non-accelerator-network hosts) if PSI_GFA_FACILITY is +# set, so we need to set that explicitly. +# +# Usage: setup_epics_env +setup_epics_env() { + local ENV=$1 + + export PSI_GFA_FACILITY=SLS + . /etc/profile.d/cas_12_epics.sh + + if [ "${ENV}" = "dev" ]; then + export EPICS_CA_ADDR_LIST="$EPICS_CA_ADDR_LIST 129.129.146.255" + fi +} diff --git a/.gitea/scripts/deploy-service.sh b/.gitea/scripts/deploy-service.sh index 500b1d6..7775eeb 100755 --- a/.gitea/scripts/deploy-service.sh +++ b/.gitea/scripts/deploy-service.sh @@ -5,6 +5,7 @@ source "$(dirname "$0")/common.sh" init_service_env "${1:-}" "${2:-}" +setup_epics_env "${AGEBD_ENV}" DO_RESTART_SERVICE=$3 NOW=$(date +%Y-%m-%dT%H:%M:%S%Z)