Skip to content

Commit

Permalink
Attempt a decent go of the entire workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeGat committed Aug 1, 2024
1 parent 0f4d2b3 commit ae5838b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/settings-1-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ jobs:
with:
deployment-environment: ${{ matrix.update.deployment-environment }}
spack-type: ${{ matrix.update.type }}
spack-update: '' # {"0.20": "7r8y43r8", "0.21": "wr7834yr", ...}
spack-update: ${{ matrix.update.spack }} # {"0.20": "7r8y43r8", "0.21": "wr7834yr", ...}
secrets: inherit
66 changes: 35 additions & 31 deletions .github/workflows/settings-2-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,40 @@ jobs:
# hosts: ${{ secrets.HOST }}
# private-key: ${{ secrets.SSH_KEY }}

# - name: Update
# run: |
# ssh ${{ secrets.USER}}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
# versions=$(jq --null-input --compact-output --raw-output \
# --argjson vs "${{ inputs.spack-update }}" \
# '$vs | keys | @sh'
# )
# for version in "$versions"; do
# new_commit=$(jq --null-input --compact-output --raw-output \
# --arg v "$version" \
# --argjson vs "${{ inputs.spack-update }}" \
# '$vs[$v]'
# )
# current_head_commit=$(git -C ${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack rev-parse HEAD)
# if [ $? -eq 128 ]; then
# echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack does not exist. Deploy it via build-cds Create Deployment Spack workflow first."
# continue
# fi
- name: Update
env:
GH_TOKEN: ${{ github.token }}
run: |
versions=$(jq --null-input --compact-output --raw-output \
--argjson vs "${{ inputs.spack-update }}" \
'$vs | keys | @sh'
)
for version in $versions; do
new_commit=$(jq --null-input --compact-output --raw-output \
--arg v "$version" \
--argjson vs "${{ inputs.spack-update }}" \
'$vs[$v]'
)
# git -C ${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack fetch
# DEBUG
gh repo clone access-nri/spack ./$version/spack -- -b releases/v$version
# if [[ "$current_head_commit" != "$new_commit" ]]; then
# git -C ${{ secrets.SPACK_INSTALLS_ROOT_LOCATION }}/$version/spack checkout $new_commit
# if [ $? -ne 0 ]; then
# echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack failed checkout from $current_head_commit to $new_commit"
# else
# echo "::notice::Changed: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack changed from $current_head_commit to $new_commit"
# fi
# else
# echo "::notice::Unchanged: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack left at $current_head_commit"
# fi
# done
# EOT
current_head_commit=$(git -C ./$version/spack rev-parse HEAD)
if [ $? -eq 128 ]; then
echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack does not exist. Deploy it via build-cds Create Deployment Spack workflow first."
continue
fi
git -C ./$version/spack fetch
if [[ "$current_head_commit" != "$new_commit" ]]; then
git -C ./$version/spack checkout $new_commit
if [ $? -ne 0 ]; then
echo "::error::Error: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack failed checkout from $current_head_commit to $new_commit"
else
echo "::notice::Changed: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack changed from $current_head_commit to $new_commit"
fi
else
echo "::notice::Unchanged: ${{ inputs.deployment-environment }} ${{ inputs.spack-type }} $version spack left at $current_head_commit"
fi
done
1 change: 0 additions & 1 deletion config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@
}
}
}

0 comments on commit ae5838b

Please sign in to comment.