Commit Graph
19 Commits
Author SHA1 Message Date
Benjamin LabrecqueandClaude Opus 5 cfd3ecad6c refactor: centralize deploy-time substitutions (steps 1-2)
Deploy-time placeholders were spread across four independent
implementations: sed in the Gitea deploy script, ansible.builtin.replace
in two playbooks, a hardcoded suffix in bin/sls_hla_launch_gui.sh, and
another in agebd/pv.py. Each defined its own values, so nothing kept them
in sync and a missed substitution failed silently.

Step 1 -- one source of truth:

  * config/environments.yml declares every deploy-time token, its value
    per environment, and where tokens are allowed to live. An environment
    that is missing a token, or defines an undeclared one, is a load-time
    error.
  * agebd.subs loads it and renders. Rendering is a strict regex over
    declared token names rather than a template engine: the rendered
    files are EPICS db/substitution files and Qt XML, and an unknown
    token must raise rather than survive into the output.
  * scripts/ci/check_subs.py enforces the contract in CI: tokens in a
    rendered path are declared, declared tokens only appear where they
    are rendered or generated, and no pre-migration delimiters survive.

Step 2 -- separate the two substitution stages by delimiter:

  * Creation-time (copier, once per new service) keeps {{ token }}.
    Deploy-time (every deploy, per environment) becomes @@token@@.
  * This drops the {{ '{{ token }}' }} escaping from templates/, which
    existed only because one Jinja pass had to emit syntax for a second.
  * Angle brackets were tried first and rejected: << >> is not
    well-formed XML, and cli parses qt/*.ui with ElementTree.
  * The existing sed and ansible consumers are repointed at the new
    delimiters so this stays behaviour-preserving. Routing them through
    agebd.subs is step 3.

Also fixes, as a side effect of having one implementation:

  * The sed pattern '{{ *agebd_env_suffix_upper* }}' quantified 'r'
    rather than the space, so it only matched one exact spacing.
  * agebd.subs.read_ioc_port compares service names case-insensitively;
    ansible/tasks/utils/get-ioc-port.yml still compares CamelCase
    registry names against a lowercase input and never matches.

qt/*.ui is declared as a render path but nothing renders it yet -- the
Qt deploy step is still a plain rsync. Wiring that up is step 4.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:26:49 +02:00
Benjamin Labrecque da4836ac0a fix: DBPM3Current -> DBPM3Curr
Deploy / deploy (push) Successful in 7s
2026-08-05 16:45:17 +02:00
labrec_bandBenjamin Labrecque a06fded916 Use explicit agebd_env_suffix lower/upper (#65)
Deploy / deploy (push) Failing after 42s
Sub env vars cicd

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #65
2026-08-05 11:02:18 +02:00
labrec_bandBenjamin Labrecque 1933b906de Feature/cli add service gui creation options (#12)
Deploy / deploy (push) Successful in 8s
Add option to use the GUI of an existing service when creating new services

---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #12
2026-07-28 16:39:01 +02:00
Benjamin Labrecque 4a4b2f33ba chore: Liftime* -> Tau*
Deploy / deploy (push) Successful in 8s
2026-07-28 10:05:32 +02:00
Benjamin Labrecque e42f162c26 chore: use camelcase name in gui 2026-07-28 09:45:48 +02:00
Benjamin Labrecque 0bf7f179de chore: change user -> ioc_owner 2026-07-28 08:40:22 +02:00
Benjamin Labrecque 6fd97bf813 chore: add test to make sure all files committed in cli add new service command 2026-07-27 11:37:09 +02:00
Benjamin Labrecque 3de7536b27 feat: add script to check that UI files contain the env suffix macro for dev/prod
Deploy / deploy (push) Successful in 1m33s
2026-07-27 10:00:35 +02:00
Benjamin Labrecque 90bd22c0e5 feat: add to AGEBD PVs in ui files 2026-07-27 08:56:05 +02:00
Benjamin Labrecque ce1ff1148a feat: write ui file to qt/ dir on new service creation 2026-07-27 08:39:07 +02:00
Benjamin Labrecque f758bfe807 chore: add python unbuffered to systemd unit files
Deploy / deploy (push) Successful in 1m10s
2026-07-24 16:37:33 +02:00
Benjamin Labrecque c341972362 chore: use sls2om package from gitea sls org
Deploy / deploy (push) Failing after 1m22s
2026-07-24 14:09:34 +02:00
labrec_bandBenjamin Labrecque e098f8b019 chore: remove pv external and only append -DEV suffix on service internal PVs (#11)
Deploy / deploy (push) Failing after 1s
Use service name to determine whether to use dev or prod PVs in dev environment

---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #11
2026-07-24 09:37:03 +02:00
Benjamin Labrecque 03a171c54d cli: better comments for tests 2026-07-23 15:46:06 +02:00
Benjamin Labrecque e310453487 cli: add tests for agebd service new 2026-07-23 15:41:22 +02:00
Benjamin Labrecque 9174f573d4 test: add cli test fixtures
Deploy / deploy (push) Failing after 3s
2026-07-23 13:57:21 +02:00
Benjamin Labrecque 7e690a907e refactor: add paths, services ctx, and extract models to own files 2026-07-22 12:04:55 +02:00
Benjamin Labrecque e324e3abed feat: use settings for paths in cli and add tests 2026-07-22 09:30:40 +02:00