|
29 | 29 | shell: bash
|
30 | 30 | run: |
|
31 | 31 | majors_only_in_prerelease=$(jq --compact-output --raw-output \
|
32 |
| - '.deployment.${{ inputs.target }} | (.Prerelease.spack | keys) - (.Release.spack | keys) | @sh' \ |
| 32 | + '.deployment.${{ inputs.target }} | (.Prerelease | keys) - (.Release | keys) | @sh' \ |
33 | 33 | ${{ inputs.settings-path }}
|
34 | 34 | )
|
35 | 35 |
|
|
46 | 46 | # It then merges them together based on major version (Ex. [[{"0.20": "u298rer3", "0.20": "r98u349u"}], ...]).
|
47 | 47 | # And then finally compares the hashes for each major version, and returns the major versions where they differ.
|
48 | 48 | run: |
|
49 |
| - release_version_hashes=$(jq '.deployment.${{ inputs.target }}.Release.spack | to_entries' ${{ inputs.settings-path }}) |
50 |
| - prerelease_version_hashes=$(jq '.deployment.${{ inputs.target }}.Prerelease.spack | to_entries' ${{ inputs.settings-path }}) |
| 49 | + release_version_hashes=$(jq \ |
| 50 | + '.deployment.${{ inputs.target }}.Release |
| 51 | + | [ |
| 52 | + keys[] as $major | .[$major].spack as $hash |
| 53 | + | {($major): $hash} | to_entries[] |
| 54 | + ]' ${{ inputs.settings-path }} |
| 55 | + ) |
| 56 | +
|
| 57 | + prerelease_version_hashes=$(jq \ |
| 58 | + '.deployment.${{ inputs.target }}.Prerelease |
| 59 | + | [ |
| 60 | + keys[] as $major | .[$major].spack as $hash |
| 61 | + | {($major): $hash} | to_entries[] |
| 62 | + ]' ${{ inputs.settings-path }} |
| 63 | + ) |
51 | 64 |
|
52 | 65 | unequal_hashes_for_version=$(jq --compact-output --raw-output --null-input \
|
53 | 66 | --argjson r "$release_version_hashes" \
|
@@ -79,16 +92,24 @@ runs:
|
79 | 92 | run: |
|
80 | 93 | gh repo clone access-nri/spack ${{ env.CHECKOUT_DIR }} -- --no-checkout --bare --filter=blob:none
|
81 | 94 |
|
82 |
| - # Essentially, pull out all the spack 'version: hash' sections and iterate |
83 |
| - jq -cr '.deployment.${{ inputs.target }}[].spack | to_entries[] | "\(.key) \(.value)"' ${{ inputs.settings-path }} | while read -ra line; do |
| 95 | + # Essentially, pull out all the spack 'major: hash' sections and iterate |
| 96 | + version_hashes=$(jq --compact-output --raw-output \ |
| 97 | + '.deployment.${{ inputs.target }}[] |
| 98 | + | keys[] as $major | .[$major].spack as $hash |
| 99 | + | "\($major) \($hash)"' \ |
| 100 | + ${{ inputs.settings-path }} |
| 101 | + ) |
| 102 | +
|
| 103 | + # For each of the version hashes, check if $hash is in releases/v$major |
| 104 | + while read -ra line; do |
84 | 105 | version=${line[0]}
|
85 | 106 | hash=${line[1]}
|
86 | 107 | echo "Checking if $hash is in $version"
|
87 | 108 | if ! git -C ${{ env.CHECKOUT_DIR }} merge-base --is-ancestor $hash releases/v$version; then
|
88 | 109 | echo "::${{ inputs.error-level }}::Commit $hash does not exist on branch releases/v$version"
|
89 | 110 | failed=true
|
90 | 111 | fi
|
91 |
| - done |
| 112 | + done <<< "$version_hashes" |
92 | 113 |
|
93 | 114 | if [ -n $failed ]; then
|
94 | 115 | msg="Some commits referenced do not exist in access-nri/spack. Check the workflow logs."
|
|
0 commit comments