@@ -15,29 +15,35 @@ jobs:
15
15
steps :
16
16
- name : Delete GHCR image
17
17
run : |
18
- # Convert the repository name to lowercase for GHCR compatibility
19
- REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
18
+ set -x
20
19
21
- # Our PR image tag is pr-<number>-<flink_profile>
20
+ # Hardcoded GHCR image repository
21
+ REPO="datasqrl/flink-sql-runner"
22
+
23
+ # PR image tag is pr-<number>-<flink_profile>
22
24
TAG="pr-${{ github.event.number }}-${{ matrix.FLINK_PROFILE }}"
23
- IMAGE="ghcr.io/$REPO/flink-jar-runner :$TAG"
25
+ IMAGE="ghcr.io/$REPO:$TAG"
24
26
25
27
echo "Attempting to delete image: $IMAGE"
26
28
27
- # Build the Basic Auth header from your PAT credentials
29
+ # Build Basic Auth header from PAT credentials
28
30
TOKEN_BASE64="$(echo -n "${{ secrets.PAT_USERNAME }}:${{ secrets.PAT_PASSWORD }}" | base64)"
29
31
30
- # Make a GET request (including multiple Accept types) to retrieve the Docker-Content-Digest header
31
- # We use '-sD -' to capture both headers and body in RAW_RESPONSE
32
+ # Make GET request to fetch Docker-Content-Digest header
32
33
RAW_RESPONSE=$(curl -sD - \
33
34
-H "Authorization: Basic $TOKEN_BASE64" \
34
- -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json" \
35
- "https://ghcr.io/v2/$REPO/flink-jar-runner/manifests/$TAG")
35
+ -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.docker.distribution.manifest.v2+json,application/vnd.oci.image.manifest.v1+json,application/vnd.oci.image.index.v1+json" \
36
+ "https://ghcr.io/v2/$REPO/manifests/$TAG")
37
+
38
+ # Output raw response for debugging
39
+ echo "==== RAW RESPONSE START ===="
40
+ echo "$RAW_RESPONSE"
41
+ echo "==== RAW RESPONSE END ===="
36
42
37
43
# Separate headers from body
38
44
HEADERS=$(echo "$RAW_RESPONSE" | sed -n '/^HTTP/,$p' | sed '/^$/q')
39
45
40
- # Extract the Docker-Content-Digest from headers
46
+ # Extract Docker-Content-Digest from headers
41
47
DIGEST=$(echo "$HEADERS" | awk '/docker-content-digest:/ { print $2 }' | tr -d $'\r')
42
48
43
49
if [[ -z "$DIGEST" ]]; then
54
60
DELETE_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
55
61
-X DELETE \
56
62
-H "Authorization: Basic $TOKEN_BASE64" \
57
- "https://ghcr.io/v2/$REPO/flink-jar-runner/ manifests/$DIGEST")
63
+ "https://ghcr.io/v2/$REPO/manifests/$DIGEST")
58
64
59
65
if [[ "$DELETE_STATUS" -ge 200 && "$DELETE_STATUS" -lt 300 ]]; then
60
66
echo "Image deleted successfully (HTTP $DELETE_STATUS)."
0 commit comments