|
55 | 55 | echo "$updates" >> $GITHUB_OUTPUT |
56 | 56 | echo "EOF" >> $GITHUB_OUTPUT |
57 | 57 |
|
| 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 | +
|
58 | 75 | - name: Setup SSH |
59 | 76 | id: ssh |
60 | 77 | uses: access-nri/actions/.github/actions/setup-ssh@main |
@@ -119,10 +136,46 @@ jobs: |
119 | 136 | if [ $? -ne 0 ]; then |
120 | 137 | echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config failed checkout from $current_head_commit to $new_commit" |
121 | 138 | 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 | +
|
122 | 143 | echo "::notice::Changed: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config changed from $current_head_commit to $new_commit" |
123 | 144 | fi |
| 145 | +
|
124 | 146 | else |
125 | 147 | echo "::notice::Unchanged: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack-config left at $current_head_commit" |
126 | 148 | fi |
127 | 149 | done <<< "${{ steps.spack-config.outputs.updates }}" |
128 | 150 | 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 |
0 commit comments