30
30
done
31
31
32
32
33
- <<< <<< < HEAD
34
- =======
35
33
function validate_image_tag() {
36
34
manifest=$1
37
35
image=$2
@@ -43,18 +41,10 @@ function validate_image_tag() {
43
41
fi
44
42
}
45
43
46
- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
47
44
# Delete images older than DELETE_SINCE_DAYS and exit 0
48
45
if [ -n " $DELETE_SINCE_DAYS " ]; then
49
46
echo " ::notice::Deleting images older than $DELETE_SINCE_DAYS days"
50
47
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
- =======
58
48
while IFS= read -r tag; do
59
49
manifest=$( curl -s -u $HTTPS_USERNAME \
60
50
-H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
@@ -65,7 +55,6 @@ if [ -n "$DELETE_SINCE_DAYS" ]; then
65
55
created=$( curl -s -u $HTTPS_USERNAME \
66
56
https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$tag \
67
57
| jq -r ' .history[0].v1Compatibility' | jq -r ' .created' )
68
- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
69
58
created_date=$( date -d $created +%s)
70
59
current_date=$( date +%s)
71
60
days_since=$(( (current_date - created_date) / (60 * 60 * 24 ) ))
@@ -75,20 +64,12 @@ if [ -n "$DELETE_SINCE_DAYS" ]; then
75
64
-H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
76
65
https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$tag \
77
66
| 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
- =======
81
67
curl -X DELETE -u $HTTPS_USERNAME -s https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/sha256:$digest
82
- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
83
68
echo " ::warning::deleted $APP_NAME :$tag , $days_since days old"
84
69
else
85
70
echo " $APP_NAME :$tag is $days_since days old"
86
71
fi
87
- <<< <<< < HEAD
88
- done
89
- =======
90
72
done <<< " $repo_tags"
91
- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
92
73
exit 0
93
74
fi
94
75
@@ -98,25 +79,13 @@ if [ -n $DELETE_TAG ]; then
98
79
-H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
99
80
https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$DELETE_TAG )
100
81
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
- =======
112
82
validate_image_tag " $manifest " " $REGISTRY_URL /$GITHUB_OWNER /$APP_NAME :$DELETE_TAG "
113
83
114
84
digest=$( curl -s -u $HTTPS_USERNAME \
115
85
-H " Accept: application/vnd.docker.distribution.manifest.v2+json" \
116
86
https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/$DELETE_TAG \
117
87
| sha256sum | cut -d ' ' -f 1)
118
88
curl -X DELETE -u $HTTPS_USERNAME -s \
119
- >>>>>>> b63724af1a7542546a7f1694f540e0015d447a62
120
89
https://$REGISTRY_URL /v2/$GITHUB_OWNER /$APP_NAME /manifests/sha256:$digest
121
90
122
91
echo " ::warning::deleted $REGISTRY_URL /$GITHUB_OWNER /$APP_NAME :$DELETE_TAG "
0 commit comments