Skip to content

Commit 1fd1b84

Browse files
committed
README.md: Added usage instructions and notes on workflows
1 parent 8e8ce3a commit 1fd1b84

File tree

1 file changed

+74
-13
lines changed

1 file changed

+74
-13
lines changed

README.md

+74-13
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,102 @@
11
# build-cd
22

3-
This repository houses reusable workflows for the building and deployment of ACCESS-NRI models to different environments.
3+
This repository houses reusable workflows for the building and deployment of ACCESS-NRI models to different environments.
44

55
## Overview
66

7-
This repository is broken down into two folders: `config` and `.github/workflows`.
7+
This repository is broken down into two folders: `config` and `.github/workflows`.
88

9-
`config` contains information on the deployment environments that the models deploy to, which is currently just the name of the deployment target. This is used by the aforementioned deployment workflows to gather secrets and configuration details from the associated GitHub Environment.
9+
`config` contains information on the deployment environments that the models deploy to, which is currently just the name of the deployment target. This is used by the aforementioned deployment workflows to gather secrets and configuration details from the associated GitHub Environment.
1010

1111
`.github/workflows` houses validation and reusable deployment workflows that are called by ACCESS-NRI model repositories. Currently, only [ACCESS-NRI/ACCESS-OM2](https://github.com/ACCESS-NRI/access-om2) is supported.
1212

13-
Below is a brief summary of the two pipelines, `deploy-*` and `validate-json`.
13+
Below is a brief summary of the three pipelines, `deploy-*`, `undeploy-*` and `validate-json`.
1414

15-
### deploy-*
15+
### `deploy-*`
1616

17-
This pipeline is responsible for the gathering of configuration information, building and deployment of whatever model repository calls it. It is split into two workflows, as noted below.
17+
#### Inputs
1818

19-
#### deploy-1-setup.yml
19+
| Name | Type | Description | Required | Default | Example |
20+
| ---- | ---- | ----------- | -------- | ------- | ------- |
21+
| `type` | string | The type of deployment - either 'release' or 'prerelease' | true | `release` | `prerelease` |
22+
| `version` | string | The version of the model being deployed | true | N/A | `2024.01.1` |
2023

21-
This workflow obtains the relevant spack and GitHub Environment information, and creates parallelized deployments based on the list of environments.
24+
#### Explanation
2225

23-
#### deploy-2-start.yml
26+
This pipeline is responsible for the gathering of configuration information, building and deployment of whatever model repository calls it. It is split into two workflows.
2427

25-
Using the GitHub Environment, it `ssh`s into the deployment environments `spack` instance, and installs the model associated with the repository that called it. It then copies back relevant metadata and creates a versioned GitHub Release in the caller repository.
28+
##### `deploy-1-setup.yml`
2629

27-
### validate-json
30+
This workflow obtains the relevant spack and GitHub Environment information, and creates parallelized deployments based on the list of environments.
2831

29-
This workflow is used to validate the `config` folders `*.json` files based on their associated `*.schema.json`. This is used for PR checks on the `build-cd` repo itself.
32+
##### `deploy-2-start.yml`
33+
34+
Using the GitHub Environment, it `ssh`s into the deployment environments `spack` instance, and installs the model associated with the repository that called it. It then copies back relevant metadata and creates a versioned GitHub Release in the caller repository, if it is not a `prerelease` deployment.
35+
36+
### `undeploy-*`
37+
38+
#### Inputs
39+
40+
| Name | Type | Description | Required | Default | Example |
41+
| ---- | ---- | ----------- | -------- | ------- | ------- |
42+
| `version-pattern` | string | A wildcard-supported string for version(s) of the model being removed | true | N/A | `2024.01.1-pre*` |
43+
44+
#### Explanation
45+
46+
This pipeline is responsible for removing deployed models from a deployment environment. Particular use-cases include removing `prerelease` builds from a deployment environment once a PR is merged.
47+
48+
##### `undeploy-1-setup.yml`
49+
50+
This workflow obtains the relevant spack and GitHub Environment information, and creates parallelized jobs removing the given `spack` environments based on the list of deployment environments.
51+
52+
##### `undeploy-2-start.yml`
53+
54+
Using the GitHub Environment, it `ssh`s into the deployment environments `spack` instance, and installs the model associated with the repository that called it. It then copies back relevant metadata and creates a versioned GitHub Release in the caller repository, if it is not a `prerelease` deployment.
55+
56+
### `validate-json.yml`
57+
58+
This workflow is used to validate the `config` folders `*.json` files based on their associated `*.schema.json`. This is used for PR checks on the `build-cd` repo itself.
59+
60+
### `create-deployment-spack.yml`
61+
62+
This workflow is used to create a version of `spack` on `Gadi`.
63+
64+
#### Inputs
65+
66+
| Name | Type | Description | Required | Default | Example |
67+
| ---- | ---- | ----------- | -------- | ------- | ------- |
68+
| `spack-version` | string | A version of `spack` | true | N/A | `0.20` |
69+
| `spack-packages-version` | string | A version of ACCESS-NRI/spack-packages to be bundled with the install of `spack` | true | `main` | `2023.11.12` |
70+
| `spack-config-version` | string | A version of ACCESS-NRI/spack-config to be bundled with the install of `spack` | true | `main` | `2024.01.01` |
71+
| `deployment-location` | true | A path in the deployment environment where Spack should be created. For example, if it is `opt/spack`, spack will be installed under `opt/spack/<spack-version>/` | true | N/A | `/opt/spack` |
3072

3173
## Usage
3274

33-
For supported `spack`-installable ACCESS-NRI models, simply call the `deploy-1-setup.yml` reusable workflow from the given repositories workflow file, like so:
75+
### Deployment
76+
77+
For supported `spack`-installable ACCESS-NRI models, simply call the `deploy-1-setup.yml` reusable workflow from the given repositories workflow file, as shown below. Don't forget to add required inputs!
3478

3579
```yml
3680
deploy:
3781
uses: access-nri/build-cd/.github/workflows/deploy-1-setup.yml@main
82+
with:
83+
type: release
84+
version: 1.2.3
3885
secrets: inherit
3986
permissions:
4087
contents: write
4188
```
89+
90+
### Removing Deployment
91+
92+
For given `spack` environments, we can also remove deployments. For example:
93+
94+
```yml
95+
remove-prereleases:
96+
uses: access-nri/build-cd/.github/workflows/undeploy-2-setup.yml@main
97+
with:
98+
version-pattern: ${{ inputs.model }}-pre*
99+
secrets: inherit
100+
```
101+
102+
This will remove every `spack` environment from the deployment target that matches `<model>-pre*`.

0 commit comments

Comments
 (0)