Skip to content

Commit 0d9550a

Browse files
authored
fix(ci): make docker rate limits appear correctly (#946)
This makes it more obvious if rate limits are in place. Example for an authenticated user: ``` regctl image ratelimit ubuntu:latest { "Remain": 0, "Limit": 0, "Reset": 0, "Set": false, "Policies": null } ``` Or unauthenticated: ``` regctl image ratelimit ubuntu:latest { "Remain": 100, "Limit": 100, "Reset": 0, "Set": true, "Policies": [ "100;w=21600" ] } ``` --------- Signed-off-by: Rafael Matias <[email protected]>
1 parent 3a0a9a0 commit 0d9550a

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

.github/actions/docker-login/action.yaml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,9 @@ runs:
2929
username: ${{ inputs.username }}
3030
password: ${{ inputs.password }}
3131

32+
- name: Install regctl
33+
uses: regclient/actions/regctl-installer@ce5fd131e371ffcdd7508b478cb223b3511a9183
34+
3235
- name: Check Docker Hub Rate Limits
3336
shell: bash
34-
env:
35-
DOCKER_USERNAME: ${{ inputs.username }}
36-
DOCKER_PASSWORD: ${{ inputs.password }}
37-
run: |
38-
if [ "$AUTH_EXISTS" = "true" ]; then
39-
echo "Authenticated."
40-
TOKEN=$(curl -s --user "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
41-
else
42-
echo "Unauthenticated."
43-
TOKEN=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
44-
fi
45-
echo "Rate limits:"
46-
curl -s --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1 | grep ratelimit
37+
run: regctl image ratelimit ubuntu:latest

0 commit comments

Comments
 (0)