Skip to content

Commit 552536c

Browse files
authored
Delete old unversioned images (#1108)
- Delete only images without the `v*` tag. - Delete only images older than 9 months (recent unversioned images are useful for debugging). http://b/208859194
1 parent eaf7241 commit 552536c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Jenkinsfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ pipeline {
162162
'''
163163
}
164164
}
165+
166+
stage('Delete Old Unversioned Images') {
167+
steps {
168+
sh '''#!/bin/bash
169+
set -exo pipefail
170+
gcloud container images list-tags gcr.io/kaggle-images/python --filter="NOT tags:v* AND timestamp.datetime < -P9M" --format='get(digest)' --limit 100 | xargs -I {} gcloud container images delete gcr.io/kaggle-images/python@{} --quiet --force-delete-tags
171+
gcloud container images list-tags gcr.io/kaggle-private-byod/python --filter="NOT tags:v* AND timestamp.datetime < -P9M" --format='get(digest)' --limit 100 | xargs -I {} gcloud container images delete gcr.io/kaggle-private-byod/python@{} --quiet --force-delete-tags
172+
'''
173+
}
174+
}
165175
}
166176

167177
post {

0 commit comments

Comments
 (0)