Commit Graph
512 Commits
Author SHA1 Message Date
Benjamin LabrecqueandClaude Opus 5 ee5f331f4c feat: render qt/ at deploy time and enforce the suffix (step 4)
qt/ was declared a render path in step 1 but nothing rendered it: the Qt
deploy step was a plain rsync, so the UI files shipped with literal
placeholders in every PV name.

  * deploy.yml renders the deployed qt/ directory with render_subs.py
    after the rsync. No --service is needed; qt holds no per-service
    token, and a file that acquired one would fail the step rather than
    ship the placeholder.
  * bin/sls_hla_launch_gui.sh no longer passes an AGEBD_ENV_SUFFIX macro.
    No .ui file has referenced $(AGEBD_ENV_SUFFIX) since a06fded, and the
    suffix is now baked in at deploy time. This removes the last
    hardcoded '-DEV' outside config/environments.yml.

check_ui_files.py is rewritten for the chosen convention. It asserted the
old caQtDM macro, and its regex had stopped matching anything at all once
placeholders appeared in device names -- against the pre-fix Service
Manager it inspected 0 names, where the new check finds 16 violations.
The new rule: every AGEBD- device name carries the suffix token, except
systemd unit names, which are the same in both environments. The token
name is read from the central config so a rename cannot leave this check
enforcing a stale one.

Fixing what that check surfaced, all in A_BD_ServiceManager.ui:

  * 16 'IOC=AGEBD-CPCL-<NAME>' caInclude macro values had no suffix. The
    included UI uses them as PV prefixes ($(IOC):STATUS, $(IOC):RESTART),
    so the dev Service Manager was reading status from, and sending
    restarts to, production IOCs.
  * Two ssh commands hardcoded sls-vserv-bd-hla01, so the dev GUI's
    restart button targeted the production HLA host.
  * cli generates those macro values, so the generator emits the token
    too and new services are no longer born with the bug.

These were latent while qt/ shipped unrendered placeholders; turning
rendering on would have made them live.

Verified: dev renders -DEV device names and the -dev host, prod renders
byte-identical to the currently deployed prod files, no placeholder
survives in either, and all 24 UI files stay well-formed XML.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 12:12:11 +02:00
Benjamin LabrecqueandClaude Opus 5 5e4246508b refactor: route deploy consumers through the central config (step 3)
Both deploy paths now take their token values from
config/environments.yml instead of defining their own copies.

CI / shell path:

  * scripts/ci/render_subs.py renders deployed files via agebd.subs.
  * deploy-and-restart-service.sh drops its dev/prod if-else and its four
    sed calls for one render_subs.py invocation, and aborts the deploy if
    rendering fails rather than restarting a service whose files still
    contain placeholders.

Ansible path:

  * ansible/tasks/utils/load-substitutions.yml reads the central config on
    the controller and exposes the token table for this environment.
  * ioc-install and service-deploy-and-restart now loop over that table
    instead of listing tokens inline, so a new token needs no ansible
    edit.
  * env_suffix_upper/lower are gone from both inventories. The inventory
    says which environment it is; the central config says what that
    environment means. The facts are renamed to agebd_env_suffix_upper /
    _lower to match the token names, removing a rename trap.

Ansible keeps using ansible.builtin.replace rather than calling
agebd.subs, because ioc-install runs on hosts with no uv or Python
environment for this repo. Only the mechanism differs now; the values and
the token list are shared.

Verified: both playbook paths run locally against dev and prod and
produce the expected output, an undeclared environment fails loudly in
both paths, and a misspelled token exits non-zero instead of shipping the
placeholder.

Not addressed here, still step 5: ansible/tasks/utils/get-ioc-port.yml
matches CamelCase registry names against a lowercase input and returns
nothing, so the ansible ioc-install path cannot resolve a port. This is
pre-existing and unchanged by this commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 12:04:57 +02:00
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
labrec_b 720e260b3e Merge pull request 'refactor: extract base runner class' (#69) from refactor/extract-base-runner into main
Deploy / deploy (push) Successful in 36s
Reviewed-on: #69
2026-08-20 09:57:28 +02:00
Benjamin Labrecque ad2cbbd871 refactor: extract base runner class 2026-08-20 09:37:22 +02:00
Benjamin LabrecqueandClaude Sonnet 5 e4f0a002fb refactor: dedupe branch-name resolution and registry loading in ioc.py
Extract _resolve_branch_name and _get_registry_services helpers used
across install/start/restart and their *_all variants.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-17 11:05:05 +02:00
Benjamin Labrecque da4836ac0a fix: DBPM3Current -> DBPM3Curr
Deploy / deploy (push) Successful in 7s
2026-08-05 16:45:17 +02:00
Benjamin Labrecque 701625d158 test: cicd
Deploy / deploy (push) Successful in 51s
2026-08-05 15:54:59 +02:00
Benjamin Labrecque bd1734c02b chore: read ioc port in cicd 2026-08-05 15:54:23 +02:00
Benjamin Labrecque 62ddd40486 fix: ioc subs indentation
Deploy / deploy (push) Failing after 17s
2026-08-05 14:41:22 +02:00
Benjamin Labrecque bf354e3ea8 test: cicd
Deploy / deploy (push) Successful in 48s
2026-08-05 14:23:11 +02:00
Benjamin Labrecque 4e863b7116 fix: sed in deployments 2026-08-05 14:22:39 +02:00
Benjamin Labrecque 492ad7c1fd test: cicd
Deploy / deploy (push) Successful in 44s
2026-08-05 11:25:38 +02:00
Benjamin Labrecque 0e565e1d25 fix: subs in deployment 2026-08-05 11:19:27 +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
Benjamin Labrecque fc46d1a48b chore: use /var/cache/uv
Deploy / deploy (push) Successful in 7s
2026-08-03 16:00:30 +02:00
Benjamin Labrecque f19b828cdc docs: gui startup script
Build and Publish Site / docker (push) Successful in 5s
2026-08-03 14:49:14 +02:00
Benjamin Labrecque ce776c15f8 docs: gui startup script
Build and Publish Site / docker (push) Successful in 3s
2026-08-03 14:48:04 +02:00
labrec_bandBenjamin Labrecque dabcf8a407 Feature/gui startup script (#13)
Build and Publish Site / docker (push) Successful in 5s
Deploy / deploy (push) Successful in 8s
Add GUI startup script
---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #13
2026-08-03 14:38:27 +02:00
Benjamin Labrecque 24a27c7be3 fix EPICS_CA_ADDR_LIST for dev
Deploy / deploy (push) Successful in 12s
2026-08-03 12:41:32 +02:00
Benjamin Labrecque a67ad3668f docs: point readme to zensical docs 2026-08-03 11:04:27 +02:00
labrec_bandBenjamin Labrecque 7c86ddd3a3 Feature/add services tests cicd (#48)
Build and Publish Site / docker (push) Successful in 6s
Deploy / deploy (push) Successful in 41s
Closes:
- uv caching #51
- act runner cache #49
- services tests #20

---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #48
2026-07-31 11:34:42 +02:00
labrec_bandBenjamin Labrecque cae92e5f3c add cli tests to cicd (#47)
Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #47
2026-07-30 14:22:00 +02:00
labrec_bandBenjamin Labrecque 28fb01735e feat: add agebd package tests to cicd (#46)
Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #46
2026-07-30 14:04:47 +02:00
Benjamin Labrecque a2170ba88d chore: uv cache dir in cicd 2026-07-30 13:56:42 +02:00
labrec_bandBenjamin Labrecque 5ea5a7e913 feat: add params ioc (#45)
Deploy / deploy (push) Failing after 7s
Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #45
2026-07-30 13:47:00 +02:00
labrec_bandBenjamin Labrecque ab5534f974 Chore/migrate ansible logic to workflow steps (#44)
Deploy / deploy (push) Successful in 14s
- Move logic from ansible to bash / gitea workflow
- **TODO:** test `add-new-service` deployment logic

---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #44
2026-07-30 13:34:53 +02:00
Benjamin Labrecque 03b00da0c6 fix: docs workflow branches 2026-07-29 16:33:05 +02:00
labrec_bandBenjamin Labrecque 3aa1fc735c feat: add Gitea Pages documentation (#43)
Build and Publish Site / docker (push) Successful in 3s
feat: add Gitea Pages documentation

---------

Co-authored-by: Benjamin Labrecque <labrecque.benji@gmail.com>
Reviewed-on: #43
2026-07-29 16:32:32 +02:00
Benjamin Labrecque f62f0ec2aa docs: update cicd docs 2026-07-29 15:21:17 +02:00
Benjamin Labrecque f083681e6f template DEVICE
Deploy / deploy (push) Successful in 21s
2026-07-29 09:11:59 +02:00
Benjamin Labrecque 5101a7ba0b fix: ui names in service manager
Deploy / deploy (push) Successful in 6s
2026-07-28 16:47:25 +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 355957455a chore: fix optics camel case names in services registry 2026-07-28 11:21:34 +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 df817a0aee docs: update add new service docs 2026-07-28 08:29:34 +02:00
Benjamin Labrecque 1188cd383b docs: ioc 2026-07-28 08:19:46 +02:00
Benjamin Labrecque 8c1fddfc2c docs: python packaging -- link to linux docs 2026-07-27 17:06:37 +02:00
Benjamin Labrecque 8268a23a8f chore: add help in cli ioc commands for branch name 2026-07-27 14:18:07 +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 840f8e900d fix: run cli test in add new service 2026-07-27 10:59:46 +02:00
Benjamin Labrecque f9c44a07c7 test: cicd fix path cli 2026-07-27 10:57:22 +02:00
Benjamin Labrecque 604bf960a0 fix: set default log level to info
Deploy / deploy (push) Successful in 4s
2026-07-27 10:56:44 +02:00
Benjamin Labrecque 77ecaef87e test: cicd for cli 2026-07-27 10:48:58 +02:00
Benjamin Labrecque 82810af1dd feat: add cicd tests cli 2026-07-27 10:47:44 +02:00
Benjamin Labrecque 92c8e3ab4b test: cicd for ui
Deploy / deploy (push) Successful in 7s
2026-07-27 10:29:22 +02:00
Benjamin Labrecque 6c9bf4cc25 test: cicd for ui
Deploy / deploy (push) Failing after 41s
2026-07-27 10:28:04 +02:00
Benjamin Labrecque 5fd90ccd6d feat: add scripts/ui tests to cicd 2026-07-27 10:27:47 +02:00