diff --git a/maintainer/docker_build.sh b/maintainer/docker_build.sh index 80da326..3ea364e 100755 --- a/maintainer/docker_build.sh +++ b/maintainer/docker_build.sh @@ -25,4 +25,4 @@ else dest=test/$job_name-$CI_COMMIT_SHA fi -cmd "/kaniko/executor --context $PWD --dockerfile Dockerfile-$docker_tag* --destination $CI_REGISTRY/$CI_PROJECT_PATH/$dest" +cmd "/kaniko/executor --context $PWD --dockerfile Dockerfile-$docker_tag* --destination $CI_REGISTRY/$CI_PROJECT_PATH/$dest --cache=true --cache-repo $CI_REGISTRY/$CI_PROJECT_PATH/cache" diff --git a/maintainer/docker_clean.sh b/maintainer/docker_clean.sh index afa5358..69b7f56 100755 --- a/maintainer/docker_clean.sh +++ b/maintainer/docker_clean.sh @@ -8,3 +8,8 @@ for repo_id in $(curl -Ls --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" https://$CI_SE curl -Ls --request DELETE --data 'name_regex=.+' --data 'older_than=7d' --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/registry/repositories/$repo_id/tags" | jq done +# same for the cache repo +repo_id=$(curl -Ls --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/registry/repositories | jq -r '.[] | select(.name == "test/cuda") | [.id] | @tsv') +# delete all tags older than 30 days +curl -Ls --request DELETE --data 'name_regex=.+' --data 'older_than=30d' --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/registry/repositories/$repo_id/tags" | jq +