Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9ae97d6
Add explanation doc for the configuration structure and contents
MJGaughran Jul 30, 2026
82b721c
Add docs on writing Module configuration
MJGaughran Jul 30, 2026
d6042cf
Clarify use of container with deploy-tools
MJGaughran Jul 30, 2026
95c62ee
Mention possibility of associating schemas to config globally
MJGaughran Jul 30, 2026
1e78091
Use more specific links between docs pages
MJGaughran Jul 30, 2026
b6f5ef5
Merge branch 'main' into hla-1142-module-creation-docs
MJGaughran Aug 24, 2026
ae7ce94
Improve organisation of configuration-model diagram
MJGaughran Aug 24, 2026
1395dfa
Include all fields in configuration-model table and improve wording
MJGaughran Aug 24, 2026
a959723
Break out fields in configuration-model.md to separate tables
MJGaughran Aug 24, 2026
b645411
Move configuration-model.md into the reference section
MJGaughran Aug 24, 2026
0796057
Rename configuration-model.md to configuration.md
MJGaughran Aug 24, 2026
aab06d3
Add bolded highlights to improve distinction between tables in docs
MJGaughran Aug 24, 2026
5eeac17
Indicate requirements for yaml-language-server in how-to doc
MJGaughran Aug 24, 2026
22b27bd
Add small note on schema linking for settings.yaml
MJGaughran Aug 24, 2026
f74aa39
Clarify that using CI pipeline for deploy-tools is only a recommendation
MJGaughran Aug 24, 2026
3acc69b
Rename "per-version file" to "Release file"
MJGaughran Aug 26, 2026
57bda27
Use separate table to indicate Release-level fields
MJGaughran Aug 26, 2026
05afedf
Clarify docs regarding our recommended CI pipeline
MJGaughran Aug 26, 2026
947ef50
Remove outdated text (typo) in README
MJGaughran Aug 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The demo_configuration folder in this repository can be passed as the config_fol
the deploy-tools commands. The deployment_root needs to be a writeable location for all
files to get deployed under.

In normal use these commands are not run by hand: they act on a shared deployment area and
belong in a CI pipeline, gated by change review. Running them manually against the demo
configuration, as below, is just the quickest way to see what each does — the
These commands act on a shared deployment area, so we recommend running them from a CI
pipeline gated by change review rather than by hand. Running them manually against the demo
configuration, as below, is the quickest way to see what each does — the
[documentation](https://diamondlightsource.github.io/deploy-tools) has a hands-on tutorial
and a guide to driving them from CI.

Expand All @@ -46,7 +46,7 @@ deploy-tools validate $deployment_root $config_folder
deploy-tools sync $deployment_root $config_folder

# Compare the current deployment snapshot against what is actually deployed in the
# deployment area. CI/CD should run this before a deploy to confirm a healthy state.
# deployment area. Run this before a deploy to confirm a healthy state.
deploy-tools compare $deployment_root

```
Expand Down
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
# So we can use the ::: syntax
myst_enable_extensions = ["colon_fence"]

# Generate anchors for headings (levels 1-3) so pages can link to sections.
myst_heading_anchors = 3

# If true, Sphinx will warn about all references where the target cannot
# be found.
nitpicky = True
Expand Down
3 changes: 2 additions & 1 deletion docs/explanations/deployment-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ corresponding `modulefile`. Users put only the *modulefiles* directories on thei

Deprecation is therefore cheap and reversible: the built files never move, only the symlink
moves between `modulefiles/` and `deprecated/modulefiles/`. See
[the release lifecycle](deprecation-lifecycle.md) for the full set of transitions.
[the release lifecycle](deprecation-lifecycle.md#configuration-is-declarative) for
the full set of transitions.

## The build area

Expand Down
4 changes: 2 additions & 2 deletions docs/explanations/deployment-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ a command of their own. For the commands themselves see the [CLI reference](../c
| Step | Description | Run by |
|------|-------------|--------|
| Compare | Compare the current deployment snapshot against the modulefiles and built modules that actually exist, confirming the [deployment area](deployment-area.md) is healthy. | `compare` |
| Validate | Diff the new configuration against the current snapshot to determine the set of actions to take, and check those actions are permitted by the [release lifecycle](deprecation-lifecycle.md). | `validate`, `sync` |
| Validate | Diff the new configuration against the current snapshot to determine the set of actions to take, and check those actions are permitted by the [lifecycle guard rails](deprecation-lifecycle.md#the-guard-rails). | `validate`, `sync` |
| Build | Generate entrypoint scripts, configuration files and environment variables for each changed Module, writing them to the build area. | `sync` (`validate --test-build`) |
| Deploy | Move the built Modules from the build area into the Modules Area, link each modulefile into the live or deprecated tree according to its status, and update default versions. | `sync` |

Expand All @@ -23,4 +23,4 @@ place, or nothing changes.
read-only checks run before it. See
[snapshots and the compare safety net](snapshots-and-compare.md) for how the snapshot
ties them together, and [drive deploy-tools from CI](../how-to/ci-pipeline.md) for the
order a pipeline runs them in.
order to run them in.
4 changes: 2 additions & 2 deletions docs/explanations/deprecation-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ deleted — is expressed by adding or removing a Release in configuration and to

You never tell `deploy-tools` to "deprecate" or "remove" something directly. You describe
the set of Releases you want, and the tool compares that against the
[snapshot](snapshots-and-compare.md) of the last `sync` to derive the actions needed. Each
Release falls into one of these cases:
[snapshot](snapshots-and-compare.md#what-the-snapshot-is) of the last `sync` to derive
the actions needed. Each Release falls into one of these cases:

| Transition | Detected when… | Effect on the deployment area |
|------------|----------------|-------------------------------|
Expand Down
4 changes: 2 additions & 2 deletions docs/explanations/snapshots-and-compare.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ will not be detected. The risk of corruption is avoided at build time instead: a
is built on the same filesystem as the deployment area and published by a single atomic
rename, so a partial or failed build (including `.sif` files) is never moved into place.

This is why CI should run `compare` *before* every `sync`: it confirms the area is in the
This is why `compare` should be run *before* every `sync`: it confirms the area is in the
healthy state the last `sync` claimed to leave it in.

## Recovery is manual
Expand All @@ -55,7 +55,7 @@ Two facilities help here:
often easier to rollback the configuration to a previous state rather than fix the
latest deployment.
- `compare --from-scratch` asserts only that the deployment root exists and is *empty* —
this is the check to run in CI before the very first `sync`, when no snapshot exists yet.
this is the check to run before the very first `sync`, when no snapshot exists yet.

The git repository in the deployment area exists only to give `compare --use-ref` this
reference point. It deliberately excludes the build area and Apptainer images, and is
Expand Down
3 changes: 2 additions & 1 deletion docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ for the on-disk layout these terms refer to.
| Environment Modules | A [standard package for Linux](https://modules.readthedocs.io/en/latest/) that provides the commands for loading and unloading 'Environment Modules' (each defined by a Modulefile). Note that while we are using this system, our definition of Module is separate. If we are referring to an Environment Module, we will use the full name. |
| Modulefile | Used by the Environment Modules package to specify all details of an Environment Module. This can include executables to add to the path, environment variables to set, etc. |
| Module | A set of files that can be used to provide applications on your path, provide configuration, and set environment variables. We do this using the Environment Modules system by providing a Modulefile with the relevant configuration. |
| Application | Each Module can be configured with multiple Applications, each one providing one or more executables. There are 3 types of Application: `Apptainer` (an executable container image), `Shell` (a Bash script) and `Binary` (an executable downloaded from a URL and verified against a hash). |
| Application | Each Module can be configured with multiple Applications, each one providing one or more executables. There are 3 types of Application: `Apptainer` (an executable container image), `Shell` (a Bash script) and `Binary` (an executable downloaded from a URL and verified against a hash). See [the configuration reference](reference/configuration.md). |
| Release (noun) | A Module, including version, alongside its [lifecycle](explanations/deprecation-lifecycle.md) (i.e. deprecation) status. |
| Release file | The `<name>/<version>.yaml` file you author to define one Release. See [the configuration reference](reference/configuration.md). |
| Deployment | The declared configuration for a Deployment Area: all Releases (deprecated or not) to be maintained there, plus global settings. Written to the `deployment.yaml` snapshot by `sync`. The act of deploying is written lowercase. |
| Deployment Step | Refers to one of the primary steps that make up the deployment process. See [the deployment process](explanations/deployment-steps.md) for a breakdown. |
| End User | Refers to anybody who is intending to make use of a deployed Module. This can include the people modifying configuration themselves. |
Expand Down
1 change: 1 addition & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Practical step-by-step guides for the more experienced user.
```{toctree}
:maxdepth: 1

how-to/write-module-configuration
how-to/ci-pipeline
how-to/run-container
how-to/vscode-tasks
Expand Down
27 changes: 15 additions & 12 deletions docs/how-to/ci-pipeline.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Drive deploy-tools from CI

In normal use, nobody should run `sync`, `validate` or `compare` by hand. Those commands
touch a shared deployment area, so they belong to a CI pipeline in the configuration
repository, gated by change review. End users only edit configuration and open a change;
merging it deploys.
`sync`, `validate` and `compare` touch a shared deployment area, so we recommend driving
them from a CI pipeline in the configuration repository, gated by change review: end users
only edit configuration and open a change, and merging it deploys. `deploy-tools` does not
require this — an administrator can run the commands by hand — but a pipeline gives you
review, repeatability and one place to serialise runs.

This guide describes what that pipeline must do. It is deliberately independent of any
particular CI system — translate the responsibilities below into your own.
This guide describes the responsibilities such a pipeline has. It is deliberately
independent of any particular CI system — translate them into your own. If you run the
commands by hand, the same ordering and the [one at a time](#run-one-at-a-time) rule still
apply.

## On a proposed change

Expand All @@ -15,9 +18,9 @@ When someone opens a change (before it is merged), run, without altering the are
- `deploy-tools compare <area>` — confirm the area still matches its last snapshot, so
the change is being checked against a known-healthy baseline.
- `deploy-tools validate <area> <config>` — confirm the new configuration is valid and its
[lifecycle transitions](../explanations/deprecation-lifecycle.md) are permitted. Add
`--test-build` to build every changed Module in a temporary directory, catching build
failures before merge.
[lifecycle transitions](../explanations/deprecation-lifecycle.md#the-guard-rails) are
permitted. Add `--test-build` to build every changed Module in a temporary directory,
catching build failures before merge.

This gives reviewers a green light that the change is deployable without changing anything
on the filesystem.
Expand All @@ -32,15 +35,15 @@ When the change is merged to the main branch, deploy it:

## Run one at a time

`deploy-tools` has no locking of its own. The pipeline must ensure only one run
`deploy-tools` has no locking of its own. Whatever drives it must ensure only one run
touches the area at a time — two concurrent `sync`s, or a `sync` racing a `compare`,
can corrupt the area or report false drift. Serialise the relevant jobs (and, if
possible, restrict them to a single runner).

## Manual operations

Some tasks fall outside the automatic flows and are best run from a manually-triggered
pipeline, exposing the relevant options as parameters:
Some tasks fall outside the automatic flows and are run by hand, or from a
manually-triggered pipeline exposing the relevant options as parameters:

- **The first deployment.** A brand-new area has no snapshot to compare against, so it is
run manually rather than triggered by a merge. Use `--from-scratch`, which assumes the
Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/regenerate-schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ schemas and commit again.

If you bypass the hooks (for example with `git commit --no-verify`), regenerate the
schemas manually. The simplest way is the **Generate Schema** VSCode task (see
[the VSCode tasks guide](vscode-tasks.md)), which writes to the correct location.
[the VSCode tasks guide](vscode-tasks.md#running-a-task)), which writes to the correct location.
Equivalently, run the CLI, pointing it at that folder:

```bash
Expand Down
3 changes: 3 additions & 0 deletions docs/how-to/run-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ $ docker run ghcr.io/diamondlightsource/deploy-tools:latest --version
```

To get a released version, use a numbered release instead of `latest`.

This image is a convenient way to drive `deploy-tools` against a shared deployment area,
typically from a CI pipeline — see [drive deploy-tools from CI](ci-pipeline.md).
88 changes: 88 additions & 0 deletions docs/how-to/write-module-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Write a Module configuration

To add or change a Module, you edit YAML in the configuration folder. This guide covers
the mechanics. For the shape of the files and every field they take, see
[the configuration reference](../reference/configuration.md); to point your editor at
the matching schema, the [schema reference](../schemas.md).

## Add a new Module version

1. Create the Release file at `<config folder>/<name>/<version>.yaml`. The folder name
is the Module `name` and the filename is the `version`, so `phoebus/0.1.yaml` defines
version `0.1` of `phoebus`. The `name` and `version` inside the file must match the
path.

2. Add the schema line as the first line so your editor validates as you type:

```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/DiamondLightSource/deploy-tools/main/src/deploy_tools/models/schemas/release.json
Comment thread
ptsOSL marked this conversation as resolved.
```

The line is read by [`yaml-language-server`](https://github.com/redhat-developer/yaml-language-server),
so it takes effect in VS Code with the Red Hat YAML extension or any other editor
running that language server; elsewhere it is an inert comment. See the
[schema reference](../schemas.md) for details.

3. Define the Module. Most Modules provide one or more applications; the smallest useful
one is a single shell script:

```yaml
module:
name: my-module
version: "1.0"
description: What this Module provides
applications:
- app_type: shell
name: hello
script:
- echo "hello from my-module"
```

Swap the application for an `apptainer` or `binary` one as needed — see
[the three application types](../reference/configuration.md#the-three-application-types).

A Module doesn't have to provide an application: it can instead just set environment
variables or pull in other Modules as
[dependencies](../reference/configuration.md#a-module). Give such a Module an
empty `applications: []`.

## Set the default version

`module load <name>` with no version loads the default. If you don't choose one the
highest version is picked automatically; to pin a specific version, add it to
`settings.yaml`:

```yaml
default_versions:
my-module: "1.0"
```

`settings.yaml` can take a schema line of its own, as
[above](#add-a-new-module-version), pointing at `deployment-settings.json`.

To keep a version out of automatic selection — an alpha or release candidate, say — while
still allowing an explicit `module load <name>/<version>`, set
`exclude_from_defaults: true` on that Module.

See [default version resolution](../explanations/default-versions.md) for how the
automatic choice is made.

## Get your change deployed

How your change reaches the deployment area depends on how your site runs `deploy-tools`.
The recommended setup is a CI pipeline in the configuration repository: you open a merge
request, CI validates the change, and merging it deploys (see
[drive deploy-tools from CI](ci-pipeline.md)). CI is not a requirement — an administrator
can run the same `validate` and `sync` commands by hand instead. Either way, the
`yaml-language-server` schema line catches structural mistakes in your editor as you type,
before anyone else looks at the change.

## Change or retire a version

- **Update an existing version in place.** Rejected by default so published versions stay
stable; prefer publishing a new version. If you must, set `allow_updates: true` on the
Module — see [the guard rails](../explanations/deprecation-lifecycle.md#the-guard-rails).
- **Retire a version.** Set `deprecated: true` in the Release file to steer users away
from it. Deleting it outright has to wait until after it is deprecated (unless the
Module has `allow_updates: true`). See
[the guard rails](../explanations/deprecation-lifecycle.md#the-guard-rails).
1 change: 1 addition & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Technical reference material including APIs and release notes.
:maxdepth: 1
:glob:

reference/configuration
CLI <cli>
API <_api/deploy_tools>
Schemas <schemas>
Expand Down
Loading
Loading