Skip to content

Commit 2414202

Browse files
committed
undeploy-2-start.yml: added environment removal and cleanup logic
1 parent b6141d7 commit 2414202

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/undeploy-2-start.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
env-name:
66
type: string
77
required: true
8-
description: The spack-env-compliant environment name for the model
8+
description: The spack-env-compliant model name to remove
99
deployment-environment:
1010
type: string
1111
required: true
@@ -26,11 +26,19 @@ jobs:
2626
${{ secrets.HOST_DATA }}
2727
2828
- name: Undeploy
29-
# ssh into deployment environment, create and activate the env, install the spack.yaml.
29+
# ssh into deployment environment, create and activate the env, remove all the unneeded environments
3030
id: undeploy
3131
run: |
3232
ssh ${{ secrets.USER}}@${{ secrets.HOST }} -i ${{ steps.ssh.outputs.private-key-path }} /bin/bash <<'EOT'
33+
. ${{ vars.SPACK_CONFIG_LOCATION }}/spack-enable.bash
34+
envs=$(find ${{ vars.SPACK_LOCATION }}/var/spack/environments -type d -name '${{ inputs.env-name }}' -printf '%f ')
3335
36+
for env in $envs; do
37+
spack env activate $env
38+
spack uninstall --remove --dependents --yes-to-all --all
39+
spack env rm $env --yes-to-all
40+
done
41+
spack gc --yes-to-all
3442
EOT
3543
3644
- name: Undeploy Status Notifier

0 commit comments

Comments
 (0)