Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 10 additions & 43 deletions .github/workflows/nightly-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,53 +46,20 @@ jobs:
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
shell: bash

- name: Find CI clusters
- name: Delete all CI clusters
run: |
. venv/bin/activate
CI_CLUSTERS=$(openstack server list | grep --only-matching 'slurmci-RL.-[0-9]\+' | sort | uniq || true)
echo "DEBUG: Raw CI clusters: $CI_CLUSTERS"

if [[ -z "$CI_CLUSTERS" ]]; then
echo "No matching CI clusters found."
else
# Flatten multiline value so can be passed as env var
CI_CLUSTERS_FORMATTED=$(echo "$CI_CLUSTERS" | tr '\n' ' ' | sed 's/ $//')
echo "DEBUG: Formatted CI clusters: $CI_CLUSTERS_FORMATTED"
echo "ci_clusters=$CI_CLUSTERS_FORMATTED" >> "$GITHUB_ENV"
fi
./dev/delete-cluster.py slurmci-RL --force
shell: bash
- name: Delete CI clusters

- name: Delete all CI extra build VMs and volumes
run: |
. venv/bin/activate
if [[ -z ${ci_clusters} ]]; then
echo "No clusters to delete."
exit 0
fi

for cluster_prefix in ${ci_clusters}
do
echo "Processing cluster: $cluster_prefix"

# Get all servers with the matching name for control node
CONTROL_SERVERS=$(openstack server list --name "${cluster_prefix}-control" --format json)

# Get unique server names to avoid duplicate cleanup
UNIQUE_NAMES=$(echo "$CONTROL_SERVERS" | jq -r '.[].Name' | sort | uniq)
for name in $UNIQUE_NAMES; do
echo "Deleting cluster with control node: $name"

# Get the first matching server ID by name
server=$(echo "$CONTROL_SERVERS" | jq -r '.[] | select(.Name=="'"$name"'") | .ID' | head -n1)

# Make sure server still exists (wasn't deleted earlier)
if ! openstack server show "$server" &>/dev/null; then
echo "Server $server no longer exists, skipping $name."
continue
fi
./dev/delete-cluster.py openhpc-extra-RL --force
shell: bash

echo "Deleting cluster $cluster_prefix (server $server)..."
./dev/delete-cluster.py "$cluster_prefix" --force
done
done
- name: Delete all fatimage build VMs and volumes
run: |
. venv/bin/activate
./dev/delete-cluster.py openhpc-RL --force
shell: bash
6 changes: 6 additions & 0 deletions packer/openstack.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ variable "volume_size" {
default = 20
}

variable "volume_name" {
type = string
default = null
}

variable "image_disk_format" {
type = string
default = "raw"
Expand Down Expand Up @@ -162,6 +167,7 @@ source "openstack" "openhpc" {
use_blockstorage_volume = var.use_blockstorage_volume
volume_type = var.volume_type
volume_size = var.volume_size
volume_name = "${var.image_name}${local.image_name_version}"
metadata = var.metadata
instance_metadata = {
ansible_init_disable = "true"
Expand Down
Loading