Skip to content

Commit f7632a2

Browse files
authored
Updates for new spack-config (#368)
* Swap from spack-enable.bash to setup-env.sh * Export ACCESS_SPACK_ADMIN in spack-related steps * No longer update builtin-spack-packages via settings.json
1 parent 6f00f2a commit f7632a2

10 files changed

Lines changed: 43 additions & 102 deletions

File tree

.github/workflows/create-deployment-spack.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ jobs:
5757
run: |
5858
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
5959
mkdir ${{ env.ROOT_VERSION_LOCATION }} || exit $?
60-
git -C ${{ env.ROOT_VERSION_LOCATION }} clone -c feature.manyFiles=true ${{ inputs.spack-git-url }} --branch ${{ inputs.spack-version }}
60+
git -C ${{ env.ROOT_VERSION_LOCATION }} clone ${{ inputs.spack-git-url }} --branch ${{ inputs.spack-version }}
6161
git -C ${{ env.ROOT_VERSION_LOCATION }} clone https://github.com/ACCESS-NRI/spack-config.git --branch ${{ inputs.spack-config-version }}
62-
ln -s -r -v ${{ env.ROOT_VERSION_LOCATION }}/spack-config/v${{ steps.strip.outputs.version-dir }}/${{ vars.DEPLOYMENT_TARGET }}/* ${{ env.ROOT_VERSION_LOCATION }}/spack/etc/spack/
6362
mkdir ${{ env.ROOT_VERSION_LOCATION }}/release
6463
mkdir ${{ env.ROOT_VERSION_LOCATION }}/logs
6564
@@ -72,3 +71,6 @@ jobs:
7271
"g:vk83_w:r-X,g:ki32_mosrs:r-X,g:vk83_um:r-X,g:df42:r-X,g::---,o::---,d:g:vk83_w:r-X,d:g:ki32_mosrs:r-X,d:g:vk83_um:r-X,d:g:df42:r-X,d:g::---,d:o::---" \
7372
${{ env.ROOT_VERSION_LOCATION }}/restricted $TMPDIR/restricted
7473
EOT
74+
75+
. ${{ env.ROOT_VERSION_LOCATION }}/spack/share/spack/setup-env.sh
76+
spack -d bootstrap now

.github/workflows/deploy-2-start.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,13 @@ jobs:
198198
export DEPLOYMENT_TARGET="${{ vars.DEPLOYMENT_TARGET }}"
199199
echo "DEPLOYMENT_TARGET exported as $DEPLOYMENT_TARGET"
200200
201+
# This environment variable is used by our spack-config to delineate between a normal user
202+
# and an admin or service user that has custom config.install_trees (among other things).
203+
# See https://github.com/ACCESS-NRI/spack-config/blob/main/v1.1/include/defaults.yaml
204+
export ACCESS_SPACK_ADMIN=1
205+
201206
# Enable spack
202-
. ${{ steps.path.outputs.spack-config }}/spack-enable.bash
207+
. ${{ steps.path.outputs.spack }}/share/spack/setup-env.sh
203208
204209
# Create and activate environment
205210
spack env activate ${{ inputs.env-name }} --create --envfile ${{ vars.SPACK_YAML_LOCATION }}/${{ inputs.expected-root-spec-name }}-${{ github.run_id }}.spack.yaml
@@ -244,7 +249,12 @@ jobs:
244249
export DEPLOYMENT_TARGET="${{ vars.DEPLOYMENT_TARGET }}"
245250
echo "DEPLOYMENT_TARGET exported as $DEPLOYMENT_TARGET"
246251
247-
. ${{ steps.path.outputs.spack-config }}/spack-enable.bash
252+
# This environment variable is used by our spack-config to delineate between a normal user
253+
# and an admin or service user that has custom config.install_trees (among other things).
254+
# See https://github.com/ACCESS-NRI/spack-config/blob/main/v1.1/include/defaults.yaml
255+
export ACCESS_SPACK_ADMIN=1
256+
257+
. ${{ steps.path.outputs.spack }}/share/spack/setup-env.sh
248258
${{ steps.path.outputs.spack-environment }}/get_data_from_deployment.py \
249259
--environment ${{ steps.path.outputs.spack-environment }} \
250260
--deployment-name ${{ inputs.expected-root-spec-name }} \

.github/workflows/settings-2-deploy.yml

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,6 @@ jobs:
5555
echo "$updates" >> $GITHUB_OUTPUT
5656
echo "EOF" >> $GITHUB_OUTPUT
5757
58-
- name: Setup builtin spack-packages updates
59-
id: builtin-spack-packages
60-
# Notably, only the spack instances that are >=1.0 and have builtin-spack-packages entries will produce any output here
61-
run: |
62-
updates=$(jq --compact-output --raw-output \
63-
--arg env "${{ inputs.deployment-environment }}" \
64-
--arg type "${{ inputs.spack-type }}" \
65-
'.deployment[$env][$type] | to_entries[] | select(.value."builtin-spack-packages" != null) | "\(.key) \(.value."builtin-spack-packages")"' \
66-
${{ env.CONFIG_SETTINGS_PATH }}
67-
)
68-
69-
echo "$updates"
70-
# For multiline output, use a heredoc. See https://github.com/orgs/community/discussions/116619#discussioncomment-8994849
71-
echo "updates<<EOF" >> $GITHUB_OUTPUT
72-
echo "$updates" >> $GITHUB_OUTPUT
73-
echo "EOF" >> $GITHUB_OUTPUT
74-
7558
- name: Setup SSH
7659
id: ssh
7760
uses: access-nri/actions/.github/actions/setup-ssh@main
@@ -136,48 +119,13 @@ jobs:
136119
if [ $? -ne 0 ]; then
137120
echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config failed checkout from $current_head_commit to $new_commit"
138121
else
139-
ln -s -r -v -f \
140-
${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack-config/$version/* \
141-
${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack/etc/spack/
142-
143122
echo "::notice::Changed: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config changed from $current_head_commit to $new_commit"
123+
. ${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack/share/spack/setup-env.sh
124+
spack repo update
144125
fi
145126
146127
else
147128
echo "::notice::Unchanged: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config left at $current_head_commit"
148129
fi
149130
done <<< "${{ steps.spack-config.outputs.updates }}"
150131
EOT
151-
152-
- name: Update builtin spack-packages
153-
# This will only run for instances that have builtin-spack-packages defined in their entries (i.e. instances at spack >=1.0)
154-
continue-on-error: true
155-
run: |
156-
ssh ${{ secrets.USER}}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
157-
set +e
158-
159-
while read -ra update; do
160-
version=${update[0]}
161-
new_ref=${update[1]}
162-
163-
. ${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack-config/spack-enable.bash
164-
165-
builtin_repo_path=$(spack location --repo builtin)
166-
167-
current_head_commit=$(git -C $builtin_repo_path rev-parse HEAD)
168-
new_commit=$(git -C $builtin_repo_path rev-parse "$new_ref")
169-
170-
if [[ "$current_head_commit" != "$new_commit" ]]; then
171-
172-
spack repo update builtin --commit $new_commit
173-
174-
if [ $? -ne 0 ]; then
175-
echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version builtin-spack-packages failed checkout from $current_head_commit to $new_commit"
176-
else
177-
echo "::notice::Changed: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version builtin-spack-packages changed from $current_head_commit to $new_commit"
178-
fi
179-
else
180-
echo "::notice::Unchanged: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version builtin-spack-packages left at $current_head_commit"
181-
fi
182-
done <<< "${{ steps.builtin-spack-packages.outputs.updates }}"
183-
EOT

.github/workflows/undeploy-1-start.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
export DEPLOYMENT_TARGET="${{ vars.DEPLOYMENT_TARGET }}"
7575
echo "DEPLOYMENT_TARGET exported as $DEPLOYMENT_TARGET"
7676
77-
. ${{ steps.path.outputs.spack-config }}/spack-enable.bash
77+
. ${{ steps.path.outputs.spack-config }}/share/spack/setup-env.sh
7878
envs=$(find ${{ steps.path.outputs.spack }}/../environments -type d -name '${{ inputs.version-pattern }}' -printf '%f ')
7979
8080
for env in $envs; do

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ This is most useful for models that are using `@git.BRANCH` references for versi
154154
!update-configs [profile=PROFILE]
155155
```
156156

157-
This Comment Command creates draft PRs to linked model configuration repositories, allowing quick testing of prerelease builds against different model configurations.
157+
This Comment Command creates draft PRs to linked model configuration repositories, allowing quick testing of prerelease builds against different model configurations.
158158

159159
This command is informed by the MDRs `config/auto-configs-pr.json` file.

config/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ This schema enforces the structure shown in `settings.json`.
1818

1919
Note:
2020

21-
- For deployments using spack version keys >= `1.0` (for example `"1.0"`, `"1.1"`, `"2.0"`), each versioned entry under `deployment/<TARGET>/<Release|Prerelease>/<VERSION>` must include the field `builtin-spack-packages` in addition to `spack` and `spack-config`.
22-
- For version keys < `1.0` (for example `"0.22"`), only `spack` and `spack-config` are required. This is because historically `spack`s builtin `spack-packages` repository was versioned as part of the `spack` repository version.
21+
- Only `spack` and `spack-config` are required. `builtin` `spack-packages` is versioned solely by `spack-config`

config/settings.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
"spack-config": "2026.02.000"
1313
},
1414
"1.1": {
15-
"spack": "2e2169d5282d166f63e3ee4db8d4446c43cefa8a",
16-
"spack-config": "2026.02.003",
17-
"builtin-spack-packages": "383e969358c951abe17623696083e6f862c4488e"
15+
"spack": "018ccf07963f6f4db4baff3b198ef3080cc58949",
16+
"spack-config": "2026.04.000"
1817
}
1918
},
2019
"Prerelease": {
@@ -23,9 +22,8 @@
2322
"spack-config": "2026.02.000"
2423
},
2524
"1.1": {
26-
"spack": "2e2169d5282d166f63e3ee4db8d4446c43cefa8a",
27-
"spack-config": "2026.02.003",
28-
"builtin-spack-packages": "383e969358c951abe17623696083e6f862c4488e"
25+
"spack": "018ccf07963f6f4db4baff3b198ef3080cc58949",
26+
"spack-config": "2026.04.000"
2927
}
3028
}
3129
}

config/settings.schema.json

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"Release": {
1717
"type": "object",
1818
"patternProperties": {
19-
"^0\\.\\d+$": {
19+
"^\\d+\\.\\d+$": {
2020
"type": "object",
2121
"properties": {
2222
"spack": {
@@ -28,30 +28,14 @@
2828
},
2929
"additionalProperties": false,
3030
"required": ["spack", "spack-config"]
31-
},
32-
"^[1-9]\\d*\\.\\d+$": {
33-
"type": "object",
34-
"properties": {
35-
"spack": {
36-
"type": "string"
37-
},
38-
"builtin-spack-packages": {
39-
"type": "string"
40-
},
41-
"spack-config": {
42-
"type": "string"
43-
}
44-
},
45-
"additionalProperties": false,
46-
"required": ["spack", "builtin-spack-packages", "spack-config"]
4731
}
4832
},
4933
"additionalProperties": false
5034
},
5135
"Prerelease": {
5236
"type": "object",
5337
"patternProperties": {
54-
"^0\\.\\d+$": {
38+
"^\\d+\\.\\d+$": {
5539
"type": "object",
5640
"properties": {
5741
"spack": {
@@ -63,22 +47,6 @@
6347
},
6448
"additionalProperties": false,
6549
"required": ["spack", "spack-config"]
66-
},
67-
"^[1-9]\\d*\\.\\d+$": {
68-
"type": "object",
69-
"properties": {
70-
"spack": {
71-
"type": "string"
72-
},
73-
"builtin-spack-packages": {
74-
"type": "string"
75-
},
76-
"spack-config": {
77-
"type": "string"
78-
}
79-
},
80-
"additionalProperties": false,
81-
"required": ["spack", "builtin-spack-packages", "spack-config"]
8250
}
8351
},
8452
"additionalProperties": false

tools/service-user/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Service User Setup Scripts
2+
3+
## Overview
4+
5+
This folder contains scripts that can be used to set up a service user on a HPC platform, ready to administer Pre/Release instances of spack via [a custom site scope defined here](https://github.com/ACCESS-NRI/spack-config/blob/main/v1.1/include/defaults.yaml).
6+
7+
## Scripts
8+
9+
### Setup
10+
11+
Exports the `ACCESS_SPACK_ADMIN` environment variable to the service users `~/.bashrc`, which is used to enable admin-specific install trees and configuration.

tools/service-user/setup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
### Spack-specific exports
4+
5+
echo "export ACCESS_SPACK_ADMIN=1" >> ~/.bashrc

0 commit comments

Comments
 (0)