Compare commits
2 Commits
f24c173432
...
d7e3545a84
| Author | SHA1 | Date | |
|---|---|---|---|
| d7e3545a84 | |||
|
|
e4150d0bc3 |
@@ -33,14 +33,30 @@ jobs:
|
||||
REG_USER: ${{ secrets.REGISTRY_USER || github.repository_owner }}
|
||||
REG_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
IMAGE_LOWER=$(echo "${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')
|
||||
echo "Registry: ${REGISTRY}"
|
||||
echo "Username: '${REG_USER}' (Laenge: ${#REG_USER})"
|
||||
echo "Token gesetzt: $([ -n "${REG_TOKEN}" ] && echo ja || echo NEIN) (Laenge: ${#REG_TOKEN})"
|
||||
echo "--- Test 1: /v2/ mit Basic-Auth ---"
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}\n" -u "${REG_USER}:${REG_TOKEN}" "https://${REGISTRY}/v2/"
|
||||
echo "--- Test 2: Token-Endpoint (Bearer-Flow) ---"
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}\n" -u "${REG_USER}:${REG_TOKEN}" \
|
||||
"https://${REGISTRY}/v2/token?scope=repository:${IMAGE_NAME}:pull,push&service=container_registry" || true
|
||||
echo "Image (lower): ${IMAGE_LOWER}"
|
||||
|
||||
echo "--- API-Test: /api/v1/user (Basic-Auth gueltig?) ---"
|
||||
curl -s -o /dev/null -w "HTTP %{http_code}\n" -u "${REG_USER}:${REG_TOKEN}" "https://${REGISTRY}/api/v1/user"
|
||||
|
||||
echo "--- /v2/ Challenge (WWW-Authenticate) ---"
|
||||
HDR=$(curl -s -D - -o /dev/null "https://${REGISTRY}/v2/")
|
||||
AUTH=$(printf '%s' "$HDR" | tr -d '\r' | grep -i '^www-authenticate:' || true)
|
||||
echo "${AUTH:-(keine WWW-Authenticate Zeile)}"
|
||||
REALM=$(printf '%s' "$AUTH" | sed -n 's/.*realm="\([^"]*\)".*/\1/p')
|
||||
SERVICE=$(printf '%s' "$AUTH" | sed -n 's/.*service="\([^"]*\)".*/\1/p')
|
||||
echo "realm='${REALM}' service='${SERVICE}'"
|
||||
|
||||
if [ -n "${REALM}" ]; then
|
||||
echo "--- Token-Request am echten realm ---"
|
||||
CODE=$(curl -s -o /tmp/tok.json -w "%{http_code}" -u "${REG_USER}:${REG_TOKEN}" \
|
||||
"${REALM}?service=${SERVICE}&scope=repository:${IMAGE_LOWER}:pull,push")
|
||||
echo "HTTP ${CODE}"
|
||||
echo "Antwort (gekuerzt): $(head -c 300 /tmp/tok.json)"
|
||||
fi
|
||||
|
||||
- name: An Gitea Container Registry anmelden
|
||||
uses: docker/login-action@v3
|
||||
|
||||
Reference in New Issue
Block a user