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
No related merge requests found
...@@ -378,7 +378,7 @@ deploy_cheaha: ...@@ -378,7 +378,7 @@ deploy_cheaha:
only: only:
- main - main
cleanup: cleanup_knightly:
stage: cleanup stage: cleanup
environment: environment:
name: knightly name: knightly
...@@ -402,5 +402,22 @@ cleanup: ...@@ -402,5 +402,22 @@ cleanup:
for img in ${IMAGE_TO_BE_DELETE[@]}; do for img in ${IMAGE_TO_BE_DELETE[@]}; do
openstack image delete ${img} openstack image delete ${img}
done done
allow_failure: true rules:
when: always - 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