diff --git a/.gitea/scripts/deploy-qt.sh b/.gitea/scripts/deploy-qt.sh new file mode 100755 index 0000000..356dbd5 --- /dev/null +++ b/.gitea/scripts/deploy-qt.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Deploys the whole qt/ ui directory to /sls/bd/hla//qt. +# +# Run from the repo root (the qt/ source path is relative), e.g. +# Usage: ./.gitea/scripts/deploy-qt.sh +set -euo pipefail + +source "$(dirname "$0")/common.sh" + +AGEBD_ENV=${1:-} + +if [ -z "${AGEBD_ENV}" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +set_env_suffix "${AGEBD_ENV}" + +DEST_DIR=${HLA_ROOT}/${AGEBD_ENV}/qt + +echo "==========================================" +echo "Deploying qt/ (${AGEBD_ENV}) to ${DEST_DIR}" +echo "==========================================" + +# TODO: see https://gitea.psi.ch/sls/hla_framework_bd/issues/50 +# rm -rf "${DEST_DIR}" +# mkdir -p "${DEST_DIR}" +# cp -r ./qt/* "${DEST_DIR}/" + +mkdir -p "${DEST_DIR}" + +rsync -avz --delete \ + --exclude='.nfs*' \ + --exclude='.git/' \ + --exclude='.venv/' \ + --exclude='__pycache__/' \ + --exclude='*.pyc' \ + --exclude='.pytest_cache/' \ + ./qt/* "${DEST_DIR}/" + +### SUBSTITUTIONS +sed -i "s/{{ *agebd_env_suffix_upper* }}/${AGEBD_ENV_SUFFIX_UPPER}/g" "${DEST_DIR}/"* +sed -i "s/{{ *agebd_env_suffix_lower* }}/${AGEBD_ENV_SUFFIX_LOWER}/g" "${DEST_DIR}/"* +sed -i "s/{{ *agebd_env_suffix_paren* }}/${AGEBD_ENV_SUFFIX_PAREN}/g" "${DEST_DIR}/"* diff --git a/.gitea/workflows/add-new-service.yml b/.gitea/workflows/add-new-service.yml index 65159c0..d37019b 100644 --- a/.gitea/workflows/add-new-service.yml +++ b/.gitea/workflows/add-new-service.yml @@ -32,26 +32,8 @@ jobs: echo "service_name_lower=$SERVICE_NAME" >> $GITHUB_OUTPUT - name: Qt - deploy - env: - DEST_DIR: /sls/bd/hla/dev/qt run: | - mkdir -p "${DEST_DIR}" - - rsync -avz --delete \ - --exclude='.nfs*' \ - --exclude='.git/' \ - --exclude='.venv/' \ - --exclude='__pycache__/' \ - --exclude='*.pyc' \ - --exclude='.pytest_cache/' \ - ./qt/* "${DEST_DIR}/" - - ### SUBSTITUTIONS - source "${{ github.workspace }}/.gitea/scripts/common.sh" - set_env_suffix "dev" - sed -i "s/{{ *agebd_env_suffix_upper* }}/${AGEBD_ENV_SUFFIX_UPPER}/g" "${DEST_DIR}/"* - sed -i "s/{{ *agebd_env_suffix_lower* }}/${AGEBD_ENV_SUFFIX_LOWER}/g" "${DEST_DIR}/"* - sed -i "s/{{ *agebd_env_suffix_paren* }}/${AGEBD_ENV_SUFFIX_PAREN}/g" "${DEST_DIR}/"* + ./.gitea/scripts/deploy-qt.sh "dev" # The ioc steps read the deployed ioc files on /sls, so the service # has to be deployed before its ioc is installed. diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3a060b2..ebd9fff 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -99,29 +99,8 @@ jobs: - name: Qt - deploy if: steps.filter.outputs.qt == 'true' - env: - DEST_DIR: /sls/bd/hla/${{ env.AGEBD_ENV }}/qt run: | - # TODO: see https://gitea.psi.ch/sls/hla_framework_bd/issues/50 - # rm -rf "${DEST_DIR}" - # mkdir -p "${DEST_DIR}" - # cp -r ./qt/* "${DEST_DIR}/" - - rsync -avz --delete \ - --exclude='.nfs*' \ - --exclude='.git/' \ - --exclude='.venv/' \ - --exclude='__pycache__/' \ - --exclude='*.pyc' \ - --exclude='.pytest_cache/' \ - ./qt/* "${DEST_DIR}/" - - ### SUBSTITUTIONS - source "${{ github.workspace }}/.gitea/scripts/common.sh" - set_env_suffix "${AGEBD_ENV}" - sed -i "s/{{ *agebd_env_suffix_upper* }}/${AGEBD_ENV_SUFFIX_UPPER}/g" "${DEST_DIR}/"* - sed -i "s/{{ *agebd_env_suffix_lower* }}/${AGEBD_ENV_SUFFIX_LOWER}/g" "${DEST_DIR}/"* - sed -i "s/{{ *agebd_env_suffix_paren* }}/${AGEBD_ENV_SUFFIX_PAREN}/g" "${DEST_DIR}/"* + ./.gitea/scripts/deploy-qt.sh "${AGEBD_ENV}" # ----------------------------------------------------------------- # Services Detection, Testing, and Deployment diff --git a/.gitea/workflows/qt.yml b/.gitea/workflows/qt.yml new file mode 100644 index 0000000..2f7f907 --- /dev/null +++ b/.gitea/workflows/qt.yml @@ -0,0 +1,19 @@ +name: Qt + +# Manually re-deploy the whole qt/ ui directory in dev, from any branch. +# Handy to try out panel changes on a feature branch without pushing to main. +# There is deliberately no prod option here - prod deploys go through the +# normal push-to-main flow (see the 'Deploy' workflow), which requires review. +on: + workflow_dispatch: + +jobs: + deploy-dev: + runs-on: hla-dev + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Deploy qt from ${{ github.ref_name }} + run: | + ./.gitea/scripts/deploy-qt.sh "dev"