Files
hla_framework_bd/.gitea/workflows/add-new-service.yml
T
Benjamin LabrecqueandClaude Opus 5 430f99baa1 refactor: move ioc logic from ansible to the gitea runner
The ioc install/start/restart logic moves out of the ansible playbooks and
the 'agebd ioc ...' cli into scripts run by the gitea runner:

- ioc-install.sh / ioc-restart.sh run on the runner itself
- ioc-start.sh triggers the shellbox commands over ssh
- ioc-for-services.sh runs an action for one or all services

They read the deployed ioc files from /sls instead of cloning the repo on
the target host, so a service has to be deployed before its ioc can be
installed. The deploy script therefore also takes over the environment
suffix renaming of the subs/parameters files that ansible used to do, and
the workflow steps are ordered deploy -> install.

The commented-out ioc placeholders in the add-new-service workflow are
filled in, and a manually triggered 'Ioc' workflow replaces the removed
cli commands.

With this, nothing uses ansible anymore, so the ansible dir, the cli ioc
commands and the ansible dependencies are removed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJTevZiSsHepW2xnJGQY49
2026-08-25 10:58:39 +02:00

62 lines
1.8 KiB
YAML

name: Add new service
on:
push:
branches:
- 'feature/add-service-*'
env:
UV_CACHE_DIR: /var/cache/uv
UV_LINK_MODE: hardlink
# TODO: when to deploy to prod? Manual (i.e. the 'Ioc' workflow)?
jobs:
deploy:
runs-on: hla-dev
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cli tests
run: |
echo $UV_CACHE_DIR
uv run --directory cli pytest
- name: Parse Service Directory Name
id: parse_branch
# Uses bash shell parameter elimination to strip 'feature/add-service-' from the front
run: |
BRANCH="${{ github.ref_name }}"
SERVICE_NAME="${BRANCH#feature/add-service-}"
echo "service_name_lower=$SERVICE_NAME" >> $GITHUB_OUTPUT
# The ioc steps read the deployed ioc files on /sls, so the service
# has to be deployed before its ioc is installed.
- name: Deploy and Restart Master Service
run: |
./.gitea/scripts/deploy-and-restart-service.sh "master" "dev"
- name: Install Master IOC
run: |
./.gitea/scripts/ioc-install.sh "master" "dev"
- name: Restart Master IOC
run: |
./.gitea/scripts/ioc-restart.sh "master" "dev"
- name: Deploy and Restart New Service
run: |
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
./.gitea/scripts/deploy-and-restart-service.sh "${SERVICE_NAME}" "dev"
- name: Install New IOC
run: |
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
./.gitea/scripts/ioc-install.sh "${SERVICE_NAME}" "dev"
- name: Start New IOC
run: |
SERVICE_NAME=${{ steps.parse_branch.outputs.service_name_lower }}
./.gitea/scripts/ioc-start.sh "${SERVICE_NAME}" "dev"