3030done
3131
3232
33- <<< <<< < HEAD
34- =======
3533function validate_image_tag() {
3634 manifest=$1
3735 image=$2
@@ -43,18 +41,10 @@ function validate_image_tag() {
4341 fi
4442}
4543
46- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
4744# Delete images older than DELETE_SINCE_DAYS and exit 0
4845if [ -n " $DELETE_SINCE_DAYS " ]; then
4946 echo " ::notice::Deleting images older than $DELETE_SINCE_DAYS days"
5047 repo_tags=$( curl -s -u $HTTPS_USERNAME https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /tags/list | jq -r ' .tags[]' )
51- <<< <<< < HEAD
52- echo $repo_tags | while read -r tag ; do
53- created=$( curl -s -u $HTTPS_USERNAME \
54- https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$tag \
55- | jq -r ' .history[0].v1Compatibility' | jq -r ' .created' )
56-
57- =======
5848 while IFS= read -r tag; do
5949 manifest=$( curl -s -u $HTTPS_USERNAME \
6050 -H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
@@ -65,7 +55,6 @@ if [ -n "$DELETE_SINCE_DAYS" ]; then
6555 created=$( curl -s -u $HTTPS_USERNAME \
6656 https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$tag \
6757 | jq -r ' .history[0].v1Compatibility' | jq -r ' .created' )
68- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
6958 created_date=$( date -d $created +%s)
7059 current_date=$( date +%s)
7160 days_since=$(( (current_date - created_date) / (60 * 60 * 24 ) ))
@@ -75,20 +64,12 @@ if [ -n "$DELETE_SINCE_DAYS" ]; then
7564 -H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
7665 https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$tag \
7766 | sha256sum | cut -d ' ' -f 1)
78- <<< <<< < HEAD
79- curl -X DELETE -u $HTTPS_USERNAME https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/sha256:$digest
80- =======
8167 curl -X DELETE -u $HTTPS_USERNAME -s https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/sha256:$digest
82- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
8368 echo " ::warning::deleted $APP_NAME :$tag , $days_since days old"
8469 else
8570 echo " $APP_NAME :$tag is $days_since days old"
8671 fi
87- <<< <<< < HEAD
88- done
89- =======
9072 done <<< " $repo_tags"
91- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
9273 exit 0
9374fi
9475
@@ -98,25 +79,13 @@ if [ -n $DELETE_TAG ]; then
9879 -H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
9980 https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$DELETE_TAG )
10081
101- <<< <<< < HEAD
102- errors=$( echo $manifest | jq -r ' .errors' )
103- if [ $errors != null ]; then
104- echo " ::error::$REGISTRY_URL /$APP_NAME :$DELETE_TAG not found"
105- exit 1
106- fi
107-
108- digest=$( echo $manifest | sha256sum | cut -d ' ' -f 1)
109-
110- curl -X DELETE -u $HTTPS_USERNAME \
111- =======
11282 validate_image_tag " $manifest " " $REGISTRY_URL /$GITHUB_OWNER /$APP_NAME :$DELETE_TAG "
11383
11484 digest=$( curl -s -u $HTTPS_USERNAME \
11585 -H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
11686 https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$DELETE_TAG \
11787 | sha256sum | cut -d ' ' -f 1)
11888 curl -X DELETE -u $HTTPS_USERNAME -s \
119- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
12089 https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/sha256:$digest
12190
12291 echo " ::warning::deleted $REGISTRY_URL /$GITHUB_OWNER /$APP_NAME :$DELETE_TAG "
0 commit comments