Skip to content
Snippets Groups Projects
Commit e706102f authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Add clean up job for merge request

parent c80cb8e9
No related branches found
No related tags found
1 merge request!78Feat cleanup job
Pipeline #9952 canceled with stages
in 1 hour, 50 minutes, and 43 seconds
......@@ -378,7 +378,7 @@ deploy_cheaha:
only:
- main
cleanup:
cleanup_knightly:
stage: cleanup
environment:
name: knightly
......@@ -402,5 +402,22 @@ cleanup:
for img in ${IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
allow_failure: true
when: always
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: always
cleanup_mr:
stage: cleanup
tags:
- build
script:
- >
IMAGE_TO_BE_DELETE=($(openstack image list --sort-column Name --sort-descending -f value -c Name -c ID
| awk -v REGEX='(ood|base|compute|gpu)-PR-' '{if ($0 ~ REGEX) print $1}'))
- |
for img in ${IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img}
done
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment