A central library of runtime StreamDevice support patterns. Each pattern is a
self-contained set of StreamDevice files (protocol, EPICS DB/template and the ibek
support definition that wires them up) that an IOC instance can vendor at a pinned
version using ibek pattern.
Vendoring copies a pattern's files into an IOC instance's config/ directory and
records exactly which version was taken, with per-file integrity hashes. The IOC then
loads that device support at runtime, with no image rebuild — the generic
ioc-streamdevice image already ships StreamDevice; this repo only supplies the
per-device protocol/DB/support files.
This repo is consumed by the ibek pattern subsystem in
epics-containers/ibek. It is one of two
central pattern libraries; its sibling
ibek-runtime-support
holds non-StreamDevice runtime patterns (extra entities/DB for otherwise-generic IOCs).
A pattern is a top-level folder named after the pattern. The folder name is the pattern name used on the command line.
A pattern holds an arbitrary file-set, not a fixed triplet. The only required
member is the ibek support definition; everything else is whatever that definition
references:
| File | Role | Required |
|---|---|---|
*.ibek.support.yaml |
ibek support module: declares the entity_models, their parameters, and which DB/template files to instantiate |
yes |
db/*.proto, db/*.protocol |
StreamDevice protocol file(s) | typical |
db/*.template / db/*.db |
EPICS database/template instantiated by the entity | typical |
db/*.req |
autosave request file(s) | optional |
*.pvi.device.yaml |
PVI device descriptor (UI/PV generation) | optional |
| anything else the support yaml references | … | optional |
ibek.manifest.yaml |
declares which files are vendored, and where | yes in this repo |
README.md |
the pattern's documentation: source, entity models, files, caveats | yes in this repo |
docs/, sim/, test/ |
documentation, device simulator and tests from the DLS source release | optional |
The support yaml and PVI yamls sit at the top of the folder; the database, protocol
and autosave files sit in db/, as they do in a built support module under
/epics/support/<module>. A generic IOC that builds a pattern in links the pattern
folder there, which puts its templates on msi's ${SUPPORT}/*/db include path.
There is no hard-coded proto/template/support shape. The vendoring lock simply hashes a file list, so it already generalises to any combination of the above (or files not yet invented). Add the files your support yaml needs and they are vendored together as a unit.
A pattern folder holds two kinds of file: runtime files, which ibek pattern
copies into an IOC instance, and pattern docs, which stay in this library. The
pattern's ibek.manifest.yaml is what tells them apart. It is an ordered,
first-match-wins allow-list: each src regex is matched (re.fullmatch) against a
file's path relative to the pattern folder, and a file matched by no entry is never
vendored. Every pattern here carries the same manifest:
version: 1
vendor:
- src: '[^/]+\.(ibek\.support\.yaml|pvi\.device\.yaml)'
dest: config/
- src: 'db/([^/]+\.(template|db|req|proto|protocol))'
dest: 'config/\1'It vendors the support and PVI yamls at the top of the folder, and the runtime file
types in db/, into the instance's flat config/, and nothing else: README.md, the
manifest itself and everything under docs/, sim/ and test/ stay here. A file that
should reach the IOC must therefore sit in one of those two places with one of those
suffixes; a new runtime file type needs the db/ rule's regex extending in every
manifest. Every pattern needs this manifest. Without one, ibek vendors every file in
the folder into config/ keeping its path, so the db/ files would land in a nested
config/db/, where the IOC does not look, along with README.md, docs/, sim/ and
test/ — respectively the DLS module's own documentation and test material, and
loadable *_sim/simulation_* templates for exercising the pattern's records against a
plain simulation IOC rather than the real device.
Each pattern's README.md says which DLS module and release the pattern came from,
lists its entity models and which files are vendored, and records what a user needs to
know before loading it: templates that need more than the generic image, and upstream
defects carried as-is. How each file was obtained, and any change made to it, stays in
the header of the pattern's *.ibek.support.yaml: that file is vendored, so the notes
travel into every IOC instance that uses the pattern.
The manifest format is documented in ibek's
ibek.manifest.yaml reference.
It needs ibek 4.8 or later; an older ibek ignores the manifest and vendors every file in
the folder with its path, so the db/ files land in a nested config/db/ and the IOC
does not find them.
This repo provides StreamDevice patterns for many devices, each a top-level folder
auto-generated from the device's DLS XMLbuilder support module (etc/builder.py +
its StreamDevice protocol and EPICS template). The lakeshore340 pattern is the
worked example of the file-set:
lakeshore340/
lakeshore340.ibek.support.yaml # entity_model "lakeshore340", parameters, databases:
lakeshore340.pvi.device.yaml # PVI device descriptor
db/
lakeshore340.proto # StreamDevice protocol
lakeshore340.template # EPICS records
lakeshore340_settings.req # autosave request file
ibek.manifest.yaml # vendors the five files above - not vendored itself
README.md # pattern docs - not vendored
sim/ # device simulator - not vendored
test/ # device tests - not vendored
Extracted device files stay as close to their DLS source as possible. A pattern's
protocol/DB/template files are imported from the DLS module's built db/ directory
— the files as actually shipped in the release, already expanded by the module's own
build — copied byte-for-byte wherever the file loads unmodified as-is. Where the built
copy leaves a macro unresolved (a placeholder like $(X,undefined)), the source
<module>App/Db/*.template is imported instead. Where a file cannot load unmodified
(VisualDCT-authored databases — see Derived, below), apply only mechanical,
scripted, re-runnable transformations and record what you did in the support yaml
header, the way celerotonChopper/celerotonChopper.ibek.support.yaml and
VatLeakValve590/VatLeakValve590.ibek.support.yaml do. A hand-authored msi derivation
already in the library (for example currAmp/, eurotherm2k/, oxCryo/) is kept and
merged with — never overwritten by — a re-import from a newer DLS release. Files
imported this way carry no provenance header of their own.
Diffing a pattern against a newer DLS release means re-running the same import (or the same scripted transformation, or the same VDCT derivation) on that release and comparing the output, rather than diffing text against what is committed here.
.proto/.protocol files. StreamDevice protocol syntax is the same at DLS and in
epics-containers, so these are always exact copies.
Many DLS modules author their databases in VisualDCT, which does not exist in the
vanilla EPICS 7 base the generic IOC images build against. A verbatim VDCT template
cannot load at runtime, so .template/.db from those modules are derived:
expand() blocks become native msi substitute/include directives, #! layout
lines and template() { } blocks are dropped, and macros passed into an included
template gain a _ prefix. Done by
vdct2template.
A derived pattern must say so in its *.ibek.support.yaml header, naming the source
module, version and /dls_sw/prod/... path, and which files are derived versus
pristine. See currAmp/ for the worked example.
The procedure and its helper scripts live in the vdct-conversion skill in
builder2ibek.
DLS databases carry comment lines for DLS screen and GDA tooling:
# % gui, $(name=), edm, device.edl, P=$(P)
#% gdatag,pv,ro,$(gda_name=),RANGE,Range Selection
# %gda,subsystem,ODCurrAmp,monitor,channel1,Channel 1 value
epics-containers has no consumer for them (screens come from PVI), yet msi and
dbLoadRecords expand macros on every line, comments included, so each macro they name
would need a value or the IOC logs macLib: macro ... is undefined at boot. They are
removed from every .template/.db by
strip-dls-annotations.py, which also drops the
# % macro documentation lines and empty databases args left pointing at macros
nothing references any more. Record content is untouched. # % macro lines for live
macros, and # % autosave, # % archiver, # % alh and # % controldesk lines, stay.
Run it after importing templates from a DLS release; --check exits non-zero if any
file still needs it.
- Pristine files — diff directly against
/dls_sw/prod/*/support/<module>/. - Derived files — re-run the conversion on the new release and diff the outputs.
- Databases — every
.template/.dbhas had its annotation comments stripped, so runstrip-dls-annotations.pyover the imported release too before diffing.
For a stronger check than text diffing, expand both the pattern's template and the DLS
module's built db/ copy with msi using the same macros, then compare canonical
record/field sets. That is invariant to comment, ordering and whitespace changes, and it
is what proves a conversion preserved behaviour. currAmp passes this on all six
templates.
The repo-authored *.ibek.support.yaml is generated here rather than extracted, so
it begins with the DLS-source provenance comment described above. That comment is
static and deterministic, and is vendored along with the rest of the file.
ibek pattern copies each runtime file into an IOC instance verbatim: it adds no
header and rewrites nothing, and the per-file sha256 in the instance's
runtime-lock.yaml is taken over the library's bytes. So each file in an instance's
config/ is identical to its namesake in the pattern folder (or its db/) at the
pinned tag. The instance's provenance is the adjacent runtime-lock.yaml, which records
the library, the pinned tag and every vendored file's hash.
Each entity model has a <model>.pvi.device.yaml and a pvi: block in its
*.ibek.support.yaml pointing at it, so ibek runtime generate2 renders
<model>.pvi.bob and links it from the IOC's index.bob. The block's ui_macros
pass the entity args that the template's record names use (device, P, Q, ...).
Both are written by generate-pvi.py, which reads the model's
templates: pvi convert device only understands asyn records, which StreamDevice
templates do not have. Every record appears on the screen: on the main group,
in Settings (autosaved setpoints), in Comms, or in an Internal sub-screen
for the calc/fanout/seq plumbing, raw replies and pollers. An output record is shown
with its readback where the names pair up (SETX/X, X/X_RBV, X:WR/X:RD, ...).
Where a DLS template carried # % gui annotations, they decide what goes on the main
group, with their labels and group headings. strip-dls-annotations.py removes them
from the templates, so the script reads them from this repo's git history, at the
commit its ANNOTATION_REF names; it needs a full clone for that.
uv run generate-pvi.py # every pattern
uv run generate-pvi.py mydevice # one pattern
uv run generate-pvi.py --check # exit 1 if anything would change
uv run generate-pvi.py --report out.tsv # where each record went, and whyA pattern can steer the classification with a pvi-overrides.yaml (not vendored),
described in the script's docstring. Controls follow a record's labels too: a bo
labelled Down/Up becomes a pair of step buttons, one labelled Idle/action a
command button, and an input listed under proc in the overrides gets a button that
writes its .PROC. Each generated file starts with a header holding
a hash of its body; the script never overwrites a device yaml that lacks the header or
whose body has been edited, and reports it instead. To hand-maintain a screen, drop
the header.
Releases are cut as repo-wide semantic-version git tags, unprefixed (0.1.1,
0.1.2-beta.3, …). A tag is an immutable point covering every pattern in the repo
at that revision, so name@<tag> always resolves to the same bytes.
ibek pattern resolves @<tag> as a literal git ref: @0.1.1 works, @v0.1.1 fails
because no such ref exists.
There is intentionally no per-pattern version: a single tag versions the whole library. Bump the tag when any pattern changes; consumers opt in to the new content by moving their pin.
On the consumer side, Renovate tracks the pin using
the github-releases datasource and raises a PR to bump the pinned version when a
new tag is published, keeping IOC instances current without manual edits.
All consumer commands run against an IOC instance directory (services/<instance>/
in a services repo). ibek pattern writes the vendored files into the instance's
config/, and writes runtime-lock.yaml + ioc.schema.json at the instance root
(not in config/, which is the ≤ 1 MiB K8s ConfigMap and holds runtime inputs only).
Qualified name <library>:<pattern>@<tag> selects the library, pattern and version:
ibek pattern add ibek-runtime-streamdevice:[email protected] services/bl01t-ea-lake-01This:
- fetches the pattern's file-set at tag
0.1.1, - writes each runtime file the pattern's
ibek.manifest.yamlselects intoservices/bl01t-ea-lake-01/config/, byte-for-byte, - records
version,sourceand a per-filesha256inservices/bl01t-ea-lake-01/runtime-lock.yaml, - merges the pattern's entity models into the instance's
services/bl01t-ea-lake-01/ioc.schema.jsonand pointsconfig/ioc.yaml's first line at it (# yaml-language-server: $schema=../ioc.schema.json).
You then reference the entity in config/ioc.yaml (the entity type is
<module>.<entity_model>, here both are lakeshore340):
entities:
- type: lakeshore340.lakeshore340
P: BL01T-EA-TEST-01
PORT: p1
ADDR: 12
LOOP: 2
SCAN: 5
TEMPSCAN: 2The resulting runtime-lock.yaml looks like:
version: 1
patterns:
lakeshore340:
version: 0.1.1
source: github.com/epics-containers/ibek-runtime-streamdevice
files:
config/lakeshore340.ibek.support.yaml: sha256:…
config/lakeshore340.proto: sha256:…
config/lakeshore340.pvi.device.yaml: sha256:…
config/lakeshore340.template: sha256:…
config/lakeshore340_settings.req: sha256:…Only the files the manifest selects appear: README.md, sim/ and test/ are not
vendored.
(a hash value may be "DIRTY # <reason>" for a deliberately locally-modified file).
ibek pattern update services/bl01t-ea-lake-01 --name lakeshore340 --version 0.5.0
# or re-vendor every pinned pattern at its recorded version:
ibek pattern update services/bl01t-ea-lake-01ibek pattern check services/bl01t-ea-lake-01Re-hashes each vendored file and fails if it drifts from runtime-lock.yaml. Allow
intentional local edits with --allow-dirty (or IBEK_ALLOW_DIRTY=1); such files must
be marked DIRTY in the lock.
ibek pattern restore services/bl01t-ea-lake-01 --name lakeshore340 # one pattern
ibek pattern restore services/bl01t-ea-lake-01 # all patternsRewrites the vendored files from the locked version, discarding local edits.
ibek pattern schema services/bl01t-ea-lake-01The vendored files are generated into their runtime locations (proto/DB placement) by
ibek runtime generate2 <config-dir>when the IOC starts, so the pattern's StreamDevice protocol and DB end up where the IOC loads them from.
lakeshore340 also exists in
epics-containers/ibek-support. The
two are different delivery paths for the same device, and must not silently
diverge:
- This repo (runtime path) is canonical for runtime vendoring. Patterns are
vendored into an instance at a pinned version and loaded by a generic
ioc-streamdeviceimage with no image rebuild. There is noinstall.ymland no compilation step — just protocol/DB/support files. ibek-support'slakeshore340is the build-time / compiled path. It carries aninstall.ymland is baked into a purpose-built container image at build time.
When you change lakeshore340 device support (protocol, records, or parameters), apply
the equivalent change to both repos, or explicitly document why they differ.
Treat them as two views of one device and keep them in step.
Not every DLS StreamDevice module can take the runtime path: some need a module-specific
compiled library, .dbd, or SNL sequencer program that the generic
ioc-streamdevice image does not ship, so they are build-time-only. Those modules — and
the test used to tell them apart — are listed in
_docs/BUILD-TIME-ONLY.md.
- Create a top-level folder named after the pattern, e.g.
mydevice/. - Drop in the file-set:
mydevice.ibek.support.yaml— theibeksupport module (module name, one or moreentity_modelswith their parameters, and adatabases:list referencing the template/DB files),- in
db/: the*.proto,*.template/*.db,*.req, and any other files that support yaml references, ibek.manifest.yaml— copy it from any other pattern; extend thesrcregex of itsdb/rule only for a runtime file type it does not list,README.md— the pattern docs, following any other pattern'sREADME.md,- any publishable documentation, simulator or tests from the DLS source release, in
docs/,sim/andtest/.
- Copy each file unmodified where it works as-is. If the module is VDCT-authored,
convert it as described in Faithful storage
— scripted, never hand-edited — and record the derivation in the support yaml header.
Add nothing to the files for the vendoring step:
ibek patterncopies them verbatim. Then runuv run generate-pvi.py mydevicefor its PVI screens (see PVI screens). - Validate locally by vendoring into a scratch IOC instance:
ibek pattern add mydevice@work <instance> --source <this repo's checkout>, runibek pattern check <instance>, and confirm<instance>/config/holds the runtime files and nothing fromREADME.md,docs/,sim/ortest/. For a derived pattern also checkmsiexpands it with no undefined macros, and that its canonical record/field set matches the DLS module's builtdb/copy. - Open a PR. Once merged, cut a new semver tag (
vX.Y.Z) so consumers can pin the new pattern; Renovate will then offer the bump downstream.
Every pull request runs the checks in ci/, which also run locally from the
repo root with uv:
| Check | Command |
|---|---|
Schema: each *.ibek.support.yaml against the pinned ibek release's ibek.support.schema.json and ibek's loader; each ibek.manifest.yaml through ibek's vendoring plan |
uv run --with-requirements ci/requirements.txt ci/check_schema.py |
Autosave: each .req file holds exactly the PVs its template's # % autosave tags give |
uv run --with-requirements ci/requirements.txt ci/check_autosave.py |
| Content: no hostnames, IP addresses, internal URLs or credentials | uv run --with-requirements ci/requirements.txt ci/check_content.py |
Pattern add: a real ibek pattern add of every pattern, and of a sample together, into a scratch services repo; checks the lock, the vendored files, the instance schema and ibek pattern check |
uv run --with-requirements ci/requirements.txt ci/check_pattern_add.py |
PVI drift: every *.pvi.device.yaml and pvi: block is what generate-pvi.py writes from the templates (needs a full clone, see PVI screens) |
uv run generate-pvi.py --check |
PVI render: one IOC with an entity of every entity model, all patterns' files flattened into its config/, through ibek runtime generate2 with PVI on; every device yaml loads in pvi and renders a .bob, every model with databases has a screen on the index, and every PV on a screen (subscreens included) resolves, with the index button's macros, to a record its model's templates create |
uv run --with-requirements ci/requirements.txt ci/check_pvi.py |
Template load: every vendored template loaded through iocInit in the generic ioc-streamdevice IOC, with the macros its entity model passes, and every sim/ template, with each macro it needs set to 1 or to its value in ci/template-load.yaml |
see below |
Each takes pattern names to check only those patterns (ci/check_pvi.py --keep DIR keeps the generated IOC files). The template load test
runs inside the published generic IOC image named in .github/workflows/ci.yml:
uv run --with-requirements ci/requirements.txt ci/template_load.py prepare build/load
docker run --rm -v "$PWD:$PWD" -w "$PWD" \
ghcr.io/epics-containers/ioc-streamdevice-runtime:2.8.26ec4 \
python ci/template_load.py run build/loadWhere an entity model has an object parameter, objects in ci/template-load.yaml
names the model of the same pattern it refers to, and the checks that build an IOC put
an entity of that model in it too.
The ibek version the checks use is pinned in ci/requirements.txt; move it
deliberately when the library adopts a new ibek. Known faults in the library
content are listed, each with its reason, in ci/template-load.yaml,
ci/autosave-allow.yaml and ci/content-allow.yaml; an entry that no longer
applies fails its check, so remove it when the fault is fixed.
- _docs/BUILD-TIME-ONLY.md — StreamDevice modules that need a
module-specific compiled library,
.dbd, or SNL sequencer program the genericioc-streamdeviceimage does not ship, and the test used to tell them apart. - _docs/CHANGELOG-rescan.md — per-pattern changes from the most recent rescan of every pattern against its DLS source module's latest release.
- _docs/REJECTED_EXTRAS.md — upstream files (vendor manuals, files marked private upstream, or ones holding personal or site-internal details) not imported into any pattern, and why.