Commit Graph
100 Commits
Author SHA1 Message Date
Benjamin LabrecqueandClaude Opus 5 4a73e52a35 refactor: one definition per naming rule, drop ansible (step 5)
Consolidates the last duplicated derivations, and removes the ansible
tree along with the CLI surface that existed only to drive it.

Naming rules:

  * agebd/names.py holds ServiceName -- the single definition of how a
    service name is spelled in each context: dir_name, module_name,
    ioc_name, systemd_unit_name and the case forms. The environment
    suffix is deliberately not part of it; that stays a deploy-time
    token applied to these base names.
  * cli's Service model delegates every name_* property to it, so the
    CLI and the CI scripts derive names the same way.
  * scripts/ci/service_names.py emits the derived forms as shell
    assignments, and deploy-and-restart-service.sh evals them instead of
    carrying its own tr calls and its own copy of the systemd naming
    convention. Values are shell-quoted, and an invalid name exits
    non-zero emitting nothing, so an eval cannot leave empty variables
    behind.

Registry lookups:

  * agebd.subs.find_service_entry is now the only place that answers
    "which registry entry is this service", used by read_ioc_port,
    get_ioc_port.py and cli's ServiceRegistry. get_ioc_port.py no longer
    parses the registry itself.
  * That also settles a semantic split: ServiceRegistry matched names
    case-sensitively while read_ioc_port did not. Both now match
    case-insensitively via ServiceName, so 'tune', 'Tune' and 'TUNE'
    resolve to the same service everywhere.

Ansible removal:

  * ansible/ is deleted, along with cli/src/ioc.py, cli/src/core/
    ansible.py, the IOC_ENV enum, the ansible and ansible-runner
    dependencies, and docs/developer/ansible.md.
  * This removes the 'agebd ioc install|start|restart' commands. They
    were pure playbook wrappers, so they could not outlive the
    playbooks; IOC install, start and restart now have no automation
    path in this repo.

bin/start_service.sh keeps deriving its two name forms in bash, with a
comment saying why: it runs on the deploy host before the service venv
exists, so it cannot import agebd. It is the one deliberate exception.

Verified: get_ioc_port.py, cli's ServiceRegistry and agebd's renderer all
return 50007 for 'tune', 'Tune' and 'TUNE'; the shell-emitted names match
the committed on-disk layout for real services including the dashed
OpticsFF-X02S; the CLI runs with only the 'service' command left.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 10:35:41 +02:00
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 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 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
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 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 f9c44a07c7 test: cicd fix path cli 2026-07-27 10:57:22 +02:00
Benjamin Labrecque 77ecaef87e test: cicd for cli 2026-07-27 10:48:58 +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 f13bb368e6 fix: cli agebd service add method 2026-07-23 16:28:36 +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 c372e7e7ee fix: config files
Deploy / deploy (push) Canceled after 0s
2026-07-22 13:07:57 +02:00
Benjamin Labrecque 63f682c058 fix: test cli add service
Deploy / deploy (push) Canceled after 0s
2026-07-22 12:25:02 +02:00
Benjamin Labrecque 9280222636 fix: test cli add service 2026-07-22 12:22:03 +02:00
Benjamin Labrecque a552e537f4 fix: pass paths in ioc cli commands 2026-07-22 12:14:45 +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
Benjamin Labrecque 86212af43c docs: refactor into user and developer docs 2026-07-21 16:44:28 +02:00
Benjamin Labrecque a4ee64fb3c cli: use service name lower in ioc start 2026-07-20 16:24:26 +02:00
Benjamin Labrecque 0d18e992ec chore: ansible extract common tasks and cli send service name for ioc start 2026-07-20 16:13:18 +02:00
Benjamin Labrecque b7e938c3a7 cli: make ioc start also use name rather than port 2026-07-20 15:23:54 +02:00
Benjamin Labrecque c4d6f2afb4 cli: use env through ansible for ioc commands
Deploy / deploy (push) Canceled after 0s
2026-07-20 15:13:18 +02:00
Benjamin Labrecque b1b5616947 docs: clean todos
Deploy / deploy (push) Canceled after 0s
2026-07-20 12:28:38 +02:00
Benjamin Labrecque 2a9e546ac7 docs: update readme 2026-07-17 14:29:39 +02:00
Benjamin Labrecque cd09c99306 cli: add ioc *-all commands 2026-07-17 09:25:33 +02:00
Benjamin Labrecque e70ab0397b chore: migrate plots service 2026-07-16 09:51:28 +02:00
Benjamin Labrecque ebd60f547b fix: migrate service script 2026-07-16 09:42:21 +02:00
Benjamin Labrecque 9bafe6ca87 chore: fix python to 3.10 so local and dev/prod match 2026-07-15 15:54:23 +02:00
Benjamin Labrecque e1964c1d70 feat: restructure python app and add option to add tests for apps
Deploy and restart modified services / deploy (push) Successful in 12s
Deploy bin / deploy (push) Successful in 2s
2026-07-15 12:18:53 +02:00
Benjamin Labrecque f76c34f5c0 feat: pass branch name in ioc cli commands 2026-07-15 08:40:27 +02:00
Benjamin Labrecque 2e8b5b6f51 cli: add ioc commands
Deploy and restart modified services / deploy (push) Successful in 18s
2026-07-15 08:25:03 +02:00
Benjamin Labrecque 0619584466 fix: cli use copfile 2026-07-14 10:22:04 +02:00
Benjamin Labrecque 97ee6b9a02 fix: cli use copfile 2026-07-14 10:18:39 +02:00
Benjamin Labrecque 11f1af3bfc fix: migrate cli 2026-07-14 10:16:14 +02:00
Benjamin Labrecque 10797ff608 fix: git cli 2026-07-14 10:12:47 +02:00
Benjamin Labrecque bedf91d849 chore: add migrate cli command 2026-07-14 10:09:19 +02:00
Benjamin Labrecque 8ed6822075 chore: remove port from iocs overview 2026-07-13 16:11:15 +02:00