Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hpc-factory
Manage
Activity
Members
Labels
Plan
Issues
61
Issue boards
Milestones
Wiki
Code
Merge requests
11
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rc
hpc-factory
Commits
9b599f85
Commit
9b599f85
authored
1 year ago
by
Bo-Chun Chen
Browse files
Options
Downloads
Patches
Plain Diff
Delete base compute gpu images
parent
91619e3c
No related branches found
Branches containing commit
No related tags found
1 merge request
!78
Feat cleanup job
Pipeline
#9957
passed with stages
in 1 hour, 49 minutes, and 42 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+30
-2
30 additions, 2 deletions
.gitlab-ci.yml
with
30 additions
and
2 deletions
.gitlab-ci.yml
+
30
−
2
View file @
9b599f85
...
...
@@ -389,17 +389,45 @@ cleanup_knightly:
SERVER_TO_BE_DELETE=($(openstack server list --name $OOD_INSTANCE_NAME --sort-column Image --sort-descending -f value -c ID
| awk -v NSTK=$NUM_SERVER_TO_KEEP '{count++}
{if (count>NSTK) print}'))
-
openstack image list --sort-column Name --sort-descending -f value -c Name -c ID > images.txt
-
>
IMAGE_TO_BE_DELETE=($(
openstack image list --sort-column Name --sort-descending -f value -c Name -c ID
OOD_
IMAGE_TO_BE_DELETE=($(
cat images.txt
| awk -v NITK=$NUM_IMAGE_TO_KEEP -v REGEX=ood-$TIMESTAMP_REGEX
'{if ($0 ~ REGEX) result[count++] = $1}
END {for(i=NITK;i<count;i++) print result[i]}'))
-
>
BASE_IMAGE_TO_BE_DELETE=($(cat images.txt
| awk -v NITK=$NUM_IMAGE_TO_KEEP -v REGEX=base-$TIMESTAMP_REGEX
'{if ($0 ~ REGEX) result[count++] = $1}
END {for(i=NITK;i<count;i++) print result[i]}'))
-
>
COMPUTE_IMAGE_TO_BE_DELETE=($(cat images.txt
| awk -v NITK=$NUM_IMAGE_TO_KEEP -v REGEX=compute-$TIMESTAMP_REGEX
'{if ($0 ~ REGEX) result[count++] = $1}
END {for(i=NITK;i<count;i++) print result[i]}'))
-
>
GPU_IMAGE_TO_BE_DELETE=($(cat images.txt
| awk -v NITK=$NUM_IMAGE_TO_KEEP -v REGEX=gpu-$TIMESTAMP_REGEX
'{if ($0 ~ REGEX) result[count++] = $1}
END {for(i=NITK;i<count;i++) print result[i]}'))
-
|
for svr in ${SERVER_TO_BE_DELETE[@]}; do
openstack server delete ${svr}
done
-
|
for img in ${IMAGE_TO_BE_DELETE[@]}; do
for img in ${OOD_IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
-
|
for img in ${BASE_IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
-
|
for img in ${COMPUTE_IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
-
|
for img in ${GPU_IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
rules
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment