Skip to content

Commit 3e7bb4c

Browse files
committed
deploy-1-setup: Validate all repos using get-git-ref-info action
check-config: Validate all repositories referenced in build-cd and the caller, including new access-spack-package and builtin spack-packages
1 parent b5f5db1 commit 3e7bb4c

1 file changed

Lines changed: 92 additions & 47 deletions

File tree

.github/workflows/deploy-1-setup.yml

Lines changed: 92 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,22 @@ on:
106106
# value: ${{ jobs.check-config.outputs.spack-config-git-hash }}
107107
# description: |
108108
# Git hash of the 'access-nri/spack-config' repository at the specified version.
109-
# spack-packages-version:
110-
# value: ${{ jobs.check-config.outputs.spack-packages-version }}
109+
# builtin-spack-packages-version:
110+
# value: ${{ jobs.check-config.outputs.builtin-spack-packages-version }}
111111
# description: |
112-
# Git ref of 'access-nri/spack-packages' that is used to reference custom packages in spack.
113-
# spack-packages-git-hash:
114-
# value: ${{ jobs.check-config.outputs.spack-packages-git-hash }}
112+
# Git ref of 'spack/spack-packages' that is used to reference builtin packages in spack.
113+
# builtin-spack-packages-git-hash:
114+
# value: ${{ jobs.check-config.outputs.builtin-spack-packages-git-hash }}
115115
# description: |
116-
# Git hash of the 'access-nri/spack-packages' repository at the specified version.
116+
# Git hash of the 'spack/spack-packages' repository at the specified version.
117+
# access-spack-packages-version:
118+
# value: ${{ jobs.check-config.outputs.access-spack-packages-version }}
119+
# description: |
120+
# Git ref of 'access-nri/access-spack-packages' that is used to reference custom packages in spack.
121+
# access-spack-packages-git-hash:
122+
# value: ${{ jobs.check-config.outputs.access-spack-packages-git-hash }}
123+
# description: |
124+
# Git hash of the 'access-nri/access-spack-packages' repository at the specified version.
117125
# release-deployment-version:
118126
# value: ${{ jobs.check-spack-yaml.outputs.release }}
119127
# description: |
@@ -146,80 +154,115 @@ jobs:
146154
check-config:
147155
name: '${{ inputs.deployment-target }}: Check Config'
148156
runs-on: ubuntu-latest
157+
# A lot of outputs, versions for repositories are taken from different sources:
158+
# Taken from central build-cd config/settings.json: spack (SHA), spack-config, builtin spack-packages
159+
# Taken from caller config/versions.json: spack (branch), access-spack-packages
149160
outputs:
150-
spack-version: ${{ steps.spack.outputs.version }}
151-
spack-git-hash: ${{ steps.spack.outputs.git-hash }}
152-
spack-packages-version: ${{ steps.spack-packages.outputs.version }}
153-
spack-packages-git-hash: ${{ steps.spack-packages.outputs.git-hash }}
154-
spack-config-version: ${{ steps.spack-config.outputs.version }}
155-
spack-config-git-hash: ${{ steps.spack-config.outputs.git-hash }}
161+
spack-version: ${{ steps.config-versions-refs.outputs.spack-branch }}
162+
spack-git-hash: ${{ steps.spack-sha.outputs.sha }}
163+
164+
builtin-spack-packages-version: ${{ steps.config-settings-refs.outputs.builtin-spack-packages-ref }}
165+
builtin-spack-packages-git-hash: ${{ steps.builtin-spack-packages-sha.outputs.sha }}
166+
167+
access-spack-packages-version: ${{ steps.config-versions-refs.outputs.access-spack-packages-ref }}
168+
access-spack-packages-git-hash: ${{ steps.access-spack-packages-sha.outputs.sha }}
169+
170+
spack-config-version: ${{ steps.config-settings-refs.outputs.spack-config-ref }}
171+
spack-config-git-hash: ${{ steps.spack-config-sha.outputs.sha }}
172+
156173
config-settings-failures: ${{ steps.settings.outputs.failures }}
157174
steps:
158-
- name: Checkout ${{ github.repository }} Config
175+
# Validate the caller repository's config files and versions
176+
- name: '${{ github.repository }}: Checkout ${{ github.repository }} Config'
159177
uses: actions/checkout@v4
160178
with:
161179
path: model
162180
ref: ${{ inputs.deployment-ref }}
163181

164-
- name: Validate ${{ github.repository }} config/versions.json
182+
- name: '${{ github.repository }}: Validate config/versions.json'
165183
uses: access-nri/schema/.github/actions/validate-with-schema@main
166184
with:
167185
schema-version: ${{ inputs.config-versions-schema-version }}
168186
schema-location: au.org.access-nri/model/deployment/config/versions
169187
data-location: ./model/config/versions.json
170188

171-
- name: Validate ${{ github.repository }} config/packages.json
189+
- name: '${{ github.repository }}: Validate config/packages.json'
172190
uses: access-nri/schema/.github/actions/validate-with-schema@main
173191
with:
174192
schema-version: ${{ inputs.config-packages-schema-version }}
175193
schema-location: au.org.access-nri/model/deployment/config/packages
176194
data-location: ./model/config/packages.json
177195

178-
- name: Validate spack-packages version
179-
id: spack-packages
180-
uses: access-nri/build-cd/.github/actions/validate-repo-version@v6
196+
- name: '${{ github.repository }}: Get repository refs from config/versions.json'
197+
id: config-versions-refs
198+
run: |
199+
echo "spack-branch=$(jq --compact-output --raw-output '.spack' model/config/versions.json)" >> $GITHUB_OUTPUT
200+
echo "access-spack-packages-ref=$(jq --compact-output --raw-output '."access-spack-packages"' model/config/versions.json)" >> $GITHUB_OUTPUT
201+
202+
- name: '${{ github.repository }}: Validate spack branch'
203+
id: spack-branch-check
204+
uses: access-nri/actions/.github/actions/get-git-ref-info@main
181205
with:
182-
repo-to-check: spack-packages
183-
pr: ${{ inputs.deployment-ref }}
206+
repository: ACCESS-NRI/spack
207+
ref: releases/v${{ steps.config-versions-refs.outputs.spack-branch }}
184208

185-
- name: Validate spack version
186-
id: spack
187-
uses: access-nri/build-cd/.github/actions/validate-repo-version@v6
209+
- name: '${{ github.repository }}: Get access-spack-packages SHA'
210+
id: access-spack-packages-sha
211+
uses: access-nri/actions/.github/actions/get-git-ref-info@main
188212
with:
189-
repo-to-check: spack
190-
pr: ${{ inputs.deployment-ref }}
213+
repository: ACCESS-NRI/access-spack-packages
214+
ref: ${{ steps.config-versions-refs.outputs.builtin-spack-packages-ref }}
191215

192-
- name: Checkout build-cd Config
216+
# Validate the build-cd repository's config/settings.json for the deployment target
217+
- name: 'build-cd: Checkout build-cd Config'
193218
uses: actions/checkout@v4
194219
with:
195220
repository: access-nri/build-cd
196221
path: cd
197222

198-
- name: Get spack-config version
199-
id: spack-config
200-
env:
201-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
202-
run: |
203-
version=$(jq --compact-output --raw-output \
204-
--arg spack_version "${{ steps.spack.outputs.version }}" \
205-
'.deployment.${{ inputs.deployment-target }}.${{ inputs.deployment-type }}[$spack_version]."spack-config"' cd/config/settings.json
206-
)
207-
echo $version
208-
echo "version=$version" >> $GITHUB_OUTPUT
209-
210-
git_hash=$(gh api /repos/access-nri/spack-config/tags \
211-
| jq --compact-output --raw-output --arg v "$version" '.[] | select(.name == $v) | .commit.sha'
212-
)
213-
echo $git_hash
214-
echo "git-hash=$git_hash" >> $GITHUB_OUTPUT
215-
216-
- name: Validate build-cd config/settings.json
223+
- name: 'build-cd: Validate config/settings.json'
217224
id: settings
218225
uses: access-nri/build-cd/.github/actions/validate-deployment-settings@v6
219226
with:
220227
settings-path: ./cd/config/settings.json
221228
target: ${{ inputs.deployment-target }}
222229

230+
- name: 'build-cd: Get repository refs from config/settings.json'
231+
id: config-settings-refs
232+
run: |
233+
refs_for_deployment=$(jq \
234+
--arg spack_version "${{ steps.config-versions-refs.outputs.spack-branch }}" \
235+
'.deployment.${{ inputs.deployment-target }}.${{ inputs.deployment-type }}[$spack_version]' \
236+
cd/config/settings.json
237+
)
238+
239+
echo "$refs_for_deployment"
240+
241+
echo "spack-ref=$(jq --compact-output --raw-output '.spack' <<< "$refs_for_deployment")" >> $GITHUB_OUTPUT
242+
echo "spack-config-ref=$(jq --compact-output --raw-output '."spack-config"' <<< "$refs_for_deployment")" >> $GITHUB_OUTPUT
243+
echo "builtin-spack-packages-ref=$(jq --compact-output --raw-output '."builtin-spack-packages"' <<< "$refs_for_deployment")" >> $GITHUB_OUTPUT
244+
245+
- name: 'build-cd: Get spack SHA'
246+
id: spack-sha
247+
uses: access-nri/actions/.github/actions/get-git-ref-info@main
248+
with:
249+
repository: ACCESS-NRI/spack
250+
ref: ${{ steps.config-settings-refs.outputs.spack-ref }}
251+
252+
- name: 'build-cd: Get spack-config SHA'
253+
id: spack-config-sha
254+
uses: access-nri/actions/.github/actions/get-git-ref-info@main
255+
with:
256+
repository: ACCESS-NRI/spack-config
257+
ref: ${{ steps.config-settings-refs.outputs.spack-config-ref }}
258+
259+
- name: 'build-cd: Get builtin spack-packages SHA'
260+
id: builtin-spack-packages-sha
261+
uses: access-nri/actions/.github/actions/get-git-ref-info@main
262+
with:
263+
repository: spack/spack-packages
264+
ref: ${{ steps.config-settings-refs.outputs.builtin-spack-packages-ref }}
265+
223266
check-spack-yaml:
224267
name: '${{ inputs.deployment-target }}: Check Spack Manifest'
225268
runs-on: ubuntu-latest
@@ -369,8 +412,10 @@ jobs:
369412
spack_git_hash: "${{ needs.check-config.outputs.spack-git-hash }}",
370413
spack_config_version: "${{ needs.check-config.outputs.spack-config-version }}",
371414
spack_config_git_hash: "${{ needs.check-config.outputs.spack-config-git-hash }}",
372-
spack_packages_version: "${{ needs.check-config.outputs.spack-packages-version }}",
373-
spack_packages_git_hash: "${{ needs.check-config.outputs.spack-packages-git-hash }}",
415+
builtin_spack_packages_version: "${{ needs.check-config.outputs.builtin-spack-packages-version }}",
416+
builtin_spack_packages_git_hash: "${{ needs.check-config.outputs.builtin-spack-packages-git-hash }}",
417+
access_spack_packages_version: "${{ needs.check-config.outputs.access-spack-packages-version }}",
418+
access_spack_packages_git_hash: "${{ needs.check-config.outputs.access-spack-packages-git-hash }}",
374419
ci_configuration_check_failure: ${{ needs.check-config.outputs.config-settings-failures != '' }},
375420
release_deployment_version: "${{ needs.check-spack-yaml.outputs.release }}",
376421
spack_environment_name: "${{ needs.check-spack-yaml.outputs.spack-env-name }}",

0 commit comments

Comments
 (0)