Skip to content

Commit 39704c7

Browse files
authored
build-cd v8: Infrastructure Update for spack v1.X (Recreated) (#352)
Based on #326
1 parent fe52740 commit 39704c7

42 files changed

Lines changed: 1092 additions & 844 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/get-deploy-paths/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ This action constructs paths relevant to a deployment of `spack`.
88
| ---- | ---- | ----------- | -------- | ------- | ------- |
99
| `spack-installs-root-path` | `string` | Path to a directory within which all versions of spack are installed | `true` | N/A | `"/some/dir/apps/spack"` |
1010
| `spack-version` | `string` | Version of spack deployed. Used to construct a specific spack installation path, in conjunction with `spack-installs-root-path`. | `true` | N/A | `"0.21"` |
11-
| `deployment-environment` | `string` | Name of the GitHub deployment target environment | `true` | N/A | `"Gadi Prerelease"` |
11+
| `deployment-target` | `string` | Name of the GitHub deployment target | `true` | N/A | `"Gadi"` |
12+
| `deployment-type` | `string` | Type of the GitHub deployment target | `true` | N/A | `"Release"`, `"Prerelease"` |
1213
| `spack-environment` | `string` | Spack environment name that is used for this deployment. Used to construct Prerelease spack-packages path, which is demarcated by the environment name | `true` | N/A | `"access-om2-pr12-12"` |
1314

1415
## Outputs
@@ -29,15 +30,16 @@ This action constructs paths relevant to a deployment of `spack`.
2930
jobs:
3031
get-paths:
3132
runs-on: ubuntu-latest
32-
environment: ${{ inputs.deployment-environment }}
33+
environment: ${{ inputs.deployment-target }} ${{ inputs.deployment-type }}
3334
steps:
3435
- name: Get Deployment Paths
3536
id: paths
3637
uses: access-nri/build-cd/.github/actions/get-deploy-paths@vX
3738
with:
3839
spack-installs-root-path: ${{ vars.SPACK_INSTALLS_ROOT_PATH }}
3940
spack-version: "0.21"
40-
deployment-environment: ${{ inputs.deployment-environment }}
41+
deployment-target: ${{ inputs.deployment-target }}
42+
deployment-type: ${{ inputs.deployment-type }}
4143
spack-environment: ${{ inputs.env-name }}
4244

4345
- run: echo 'Spack is installed in `${{ steps.paths.outputs.spack }}` and spack-packages is installed in `${{ steps.paths.outputs.spack-packages }}`'

.github/actions/get-deploy-paths/action.yml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,40 @@ inputs:
99
spack-version:
1010
required: true
1111
description: |
12-
Version of spack deployed.
12+
Major branch version of spack deployed, eg. 0.22, 1.0.
1313
Used to construct a specific spack installation path, in conjunction with `spack-installs-root-path`.
14-
deployment-environment:
14+
deployment-target:
1515
required: true
16-
description: Name of the GitHub deployment target environment
16+
description: |
17+
Name of the GitHub deployment target. Combined with inputs.deployment-type to form the GitHub Environment name.
18+
For example: Gadi, Setonix
19+
deployment-type:
20+
required: true
21+
description: |
22+
Type of the GitHub deployment target. Combined with inputs.deployment-target to form the GitHub Environment name.
23+
For example: Prerelease, Release
1724
spack-environment:
1825
required: true
1926
description: |
2027
Spack environment name that is used for this deployment.
21-
Used to construct Prerelease spack-packages path, which is demarcated by the environment name.
2228
outputs:
2329
root:
2430
description: |
2531
Path to the root of a specific deployment of `spack`.
26-
This path contains `spack-{packages,config}` repositories as well.
32+
This path contains `spack-config` and various `spack-packages` repositories in it's hierarchy as well.
2733
value: ${{ steps.path.outputs.root }}
2834
spack:
2935
description: Path to a specific installation of `spack`.
3036
value: ${{ steps.path.outputs.spack }}
3137
spack-config:
3238
description: Path to the ACCESS-NRI/spack-config repository associated with the install of spack.
3339
value: ${{ steps.path.outputs.spack-config }}
34-
spack-packages-root:
35-
description: |
36-
Path to the folder containing all ACCESS-NRI/spack-packages repositories used in the install of spack.
37-
For Release inputs.deployment-environment, this is the repository itself.
38-
For Prerelease inputs.deployment-environment, this is the folder containing multiple spack-packages repositories.
39-
value: ${{ steps.path.outputs.spack-packages-root }}
40-
spack-packages:
41-
description: Path to the ACCESS-NRI/spack-packages repository associated with the environment created in the install of spack.
42-
value: ${{ steps.path.outputs.spack-packages }}
4340
spack-environment:
44-
description: Path to the spack environment folder for the given inputs.spack-environment.
41+
description: Path to the spack environment folder for the given inputs.spack-environment. Also contains the `spack-packages` repository for Prerelease deployments.
4542
value: ${{ steps.path.outputs.spack-environment }}
43+
# Regarding our other important repository path, spack-packages:
44+
# Release instances of spack-packages are now managed by spack itself via `spack repo` commands, so deployment doesn't actually need to know where it is.
45+
# Prerelease instances of spack-packages are located within the outputs.spack-environment folder, and are removed when that environment is removed, so there is no need to track them either.
4646
runs:
4747
using: composite
4848
steps:
@@ -54,32 +54,22 @@ runs:
5454
run: |
5555
# Check that the inputs.spack-installs-root-path exists - it's usually a var
5656
if [ -z '${{ inputs.spack-installs-root-path }}' ]; then
57-
echo '::error::inputs.spack-installs-root-path does not exist in ${{ github.repository }}s ${{ inputs.deployment-environment }} environment. Check Environment vars.'
57+
echo '::error::inputs.spack-installs-root-path does not exist in ${{ github.repository }}s ${{ inputs.deployment-target }} ${{ inputs.deployment-type }} environment. Check Environment vars.'
5858
exit 1
5959
fi
6060
61-
# We want the type of deployment environment, which is the last word in the string.
62-
type=$(echo '${{ inputs.deployment-environment }}' | rev | cut -d ' ' -f 1 | rev)
63-
if [[ ! '${{ env.ACCEPTABLE_DEPLOYMENT_ENVIRONMENT_TARGETS}}' =~ "$type" ]]; then
64-
echo '::error::inputs.deployment-environment must be one of ${{ env.ACCEPTABLE_ENVIRONMENT_TARGETS }}.'
61+
if [[ ! '${{ env.ACCEPTABLE_DEPLOYMENT_ENVIRONMENT_TARGETS}}' =~ "${{ inputs.deployment-type }}" ]]; then
62+
echo '::error::inputs.deployment-type must be one of ${{ env.ACCEPTABLE_DEPLOYMENT_ENVIRONMENT_TARGETS }}.'
6563
exit 1
6664
fi
6765
echo "type=$type" >> $GITHUB_OUTPUT
6866
69-
- name: Get ${{ inputs.deployment-environment }} Remote Paths
67+
- name: Get ${{ inputs.deployment-target }} ${{ inputs.deployment-type }} Remote Paths
7068
id: path
7169
shell: bash
7270
run: |
7371
root=${{ inputs.spack-installs-root-path }}/${{ inputs.spack-version }}
7472
echo "root=$root" >> $GITHUB_OUTPUT
7573
echo "spack=$root/spack" >> $GITHUB_OUTPUT
7674
echo "spack-config=$root/spack-config" >> $GITHUB_OUTPUT
77-
echo "spack-packages-root=$root/spack-packages" >> $GITHUB_OUTPUT
78-
79-
if [[ '${{ steps.validate.outputs.type }}' == Release ]]; then
80-
echo "spack-packages=$root/spack-packages" >> $GITHUB_OUTPUT
81-
elif [[ '${{ steps.validate.outputs.type }}' == Prerelease ]]; then
82-
echo "spack-packages=$root/spack-packages/${{ inputs.spack-environment }}/spack-packages" >> $GITHUB_OUTPUT
83-
fi
84-
8575
echo "spack-environment=$root/environments/${{ inputs.spack-environment }}" >> $GITHUB_OUTPUT
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Get Spack Manifest Information
2+
3+
Action that returns information about a Spack manifest file.
4+
5+
## Inputs
6+
7+
> [!NOTE]
8+
> Action assumes that an appropriate repository is checked out prior to invocation
9+
10+
| Name | Type | Description | Required | Default | Example |
11+
| ---- | ---- | ----------- | -------- | ------- | ------- |
12+
| `spack-manifest-path` | `string` | The path to the spack manifest file | `false` | `"spack.yaml"` | `"./some/other.spack.yaml"` |
13+
14+
## Outputs
15+
16+
| Name | Type | Description | Example |
17+
| ---- | ---- | ----------- | ------- |
18+
| `deployment-name` | `string` | The name of the deployment as specified in the reserved definition `_name` | `access-om2` |
19+
| `deployment-version` | `string` | The version of the deployment as specified in the reserved definition `_version` | `2025.11.000` |
20+
21+
## Example
22+
23+
```yaml
24+
# ...
25+
jobs:
26+
manifest:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- id: spec
32+
uses: access-nri/build-cd/.github/actions/get-spack-manifest@vX # for some version `vX`
33+
with:
34+
spack-manifest-path: spack.yaml
35+
36+
- run: |
37+
echo "Deploying ${{ steps.spec.outputs.deployment-name }} at ${{ steps.spec.outputs.deployment-version }}"
38+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Get Spack Manifest Information
2+
description: Action that returns information about a Spack manifest file
3+
author: Tommy Gatti
4+
inputs:
5+
spack-manifest-path:
6+
required: false
7+
default: spack.yaml
8+
description: The path to the spack manifest file
9+
outputs:
10+
deployment-name:
11+
description: |
12+
The name of the deployment as specified in the reserved definition _name, in the spack manifest file.
13+
value: ${{ steps.defs.outputs.name }}
14+
deployment-version:
15+
description: |
16+
The version of the deployment as specified in the reserved definition _version, in the spack manifest file.
17+
value: ${{ steps.defs.outputs.version }}
18+
runs:
19+
using: composite
20+
steps:
21+
- name: Clone build-cd script location
22+
uses: actions/checkout@v4
23+
with:
24+
repository: access-nri/build-cd
25+
path: ${{ github.workspace }}/getter-script
26+
27+
- name: Get Current Directory
28+
id: script
29+
# We need to store the current working directory so we can re-construct the inputs.spack-manifest-path, as we run
30+
# the script from the build-cd directory
31+
shell: bash
32+
run: |
33+
pwd=$(pwd)
34+
echo "Action PWD: $pwd"
35+
echo "pwd=$pwd" >> $GITHUB_OUTPUT
36+
37+
- name: Get reserved definitions
38+
id: defs
39+
env:
40+
PYTHONPATH: ${{ github.workspace }}/getter-script
41+
shell: python
42+
run: |
43+
from scripts.spack_manifest.getter import ReservedDefinitions
44+
import os
45+
46+
defs = ReservedDefinitions.from_file("${{ steps.script.outputs.pwd }}/${{ inputs.spack-manifest-path }}")
47+
name = defs.get("name")
48+
version = defs.get("version")
49+
50+
with open(os.environ['GITHUB_OUTPUT'], 'a') as o:
51+
o.write(f"name={name}\n")
52+
o.write(f"version={version}\n")

.github/actions/get-spack-root-spec/README.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/actions/get-spack-root-spec/action.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

.github/actions/validate-repo-version/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)