Skip to content

Commit

Permalink
validate-deployment-settings: Update checks to work with new settings…
Browse files Browse the repository at this point in the history
….json schema
  • Loading branch information
CodeGat committed Sep 18, 2024
1 parent 9a4033f commit a41494b
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions .github/actions/validate-deployment-settings/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runs:
shell: bash
run: |
majors_only_in_prerelease=$(jq --compact-output --raw-output \
'.deployment.${{ inputs.target }} | (.Prerelease.spack | keys) - (.Release.spack | keys) | @sh' \
'.deployment.${{ inputs.target }} | (.Prerelease | keys) - (.Release | keys) | @sh' \
${{ inputs.settings-path }}
)
Expand All @@ -46,8 +46,21 @@ runs:
# It then merges them together based on major version (Ex. [[{"0.20": "u298rer3", "0.20": "r98u349u"}], ...]).
# And then finally compares the hashes for each major version, and returns the major versions where they differ.
run: |
release_version_hashes=$(jq '.deployment.${{ inputs.target }}.Release.spack | to_entries' ${{ inputs.settings-path }})
prerelease_version_hashes=$(jq '.deployment.${{ inputs.target }}.Prerelease.spack | to_entries' ${{ inputs.settings-path }})
release_version_hashes=$(jq \
'.deployment.${{ inputs.target }}.Release
| [
keys[] as $major | .[$major].spack as $hash
| {($major): $hash} | to_entries[]
]' ${{ inputs.settings-path }}
)
prerelease_version_hashes=$(jq \
'.deployment.${{ inputs.target }}.Prerelease
| [
keys[] as $major | .[$major].spack as $hash
| {($major): $hash} | to_entries[]
]' ${{ inputs.settings-path }}
)
unequal_hashes_for_version=$(jq --compact-output --raw-output --null-input \
--argjson r "$release_version_hashes" \
Expand Down Expand Up @@ -79,16 +92,24 @@ runs:
run: |
gh repo clone access-nri/spack ${{ env.CHECKOUT_DIR }} -- --no-checkout --bare --filter=blob:none
# Essentially, pull out all the spack 'version: hash' sections and iterate
jq -cr '.deployment.${{ inputs.target }}[].spack | to_entries[] | "\(.key) \(.value)"' ${{ inputs.settings-path }} | while read -ra line; do
# Essentially, pull out all the spack 'major: hash' sections and iterate
version_hashes=$(jq --compact-output --raw-output \
'.deployment.${{ inputs.target }}[]
| keys[] as $major | .[$major].spack as $hash
| "\($major) \($hash)"' \
${{ inputs.settings-path }}
)
# For each of the version hashes, check if $hash is in releases/v$major
while read -ra line; do
version=${line[0]}
hash=${line[1]}
echo "Checking if $hash is in $version"
if ! git -C ${{ env.CHECKOUT_DIR }} merge-base --is-ancestor $hash releases/v$version; then
echo "::${{ inputs.error-level }}::Commit $hash does not exist on branch releases/v$version"
failed=true
fi
done
done <<< "$version_hashes"
if [ -n $failed ]; then
msg="Some commits referenced do not exist in access-nri/spack. Check the workflow logs."
Expand Down

0 comments on commit a41494b

Please sign in to comment.