add test workflow

This commit is contained in:
2026-03-14 20:20:19 +08:00
parent 888b8603d1
commit 9c69391f95
+70
View File
@@ -0,0 +1,70 @@
name: Debug Registry Login
on:
workflow_dispatch:
jobs:
debug-login:
runs-on: docker
steps:
- name: Show workflow inputs
shell: bash
run: |
set -eu
echo "REGISTRY=${{ vars.REGISTRY }}"
echo "IMAGE_NAME=${{ vars.IMAGE_NAME }}"
echo "USERNAME_SET=$([ -n "${{ secrets.REGISTRY_USERNAME }}" ] && echo yes || echo no)"
echo "PASSWORD_SET=$([ -n "${{ secrets.REGISTRY_PASSWORD }}" ] && echo yes || echo no)"
echo "USERNAME_LENGTH=$(printf '%s' '${{ secrets.REGISTRY_USERNAME }}' | wc -c)"
echo "PASSWORD_LENGTH=$(printf '%s' '${{ secrets.REGISTRY_PASSWORD }}' | wc -c)"
- name: Show runner and docker info
shell: bash
run: |
set -eu
uname -a
docker version
docker info
- name: Probe registry endpoint
shell: bash
run: |
set -eux
curl -I --max-time 20 "https://${{ vars.REGISTRY }}/v2/" || true
curl -sS -o /tmp/registry-body.txt -D /tmp/registry-headers.txt "https://${{ vars.REGISTRY }}/v2/" || true
echo "Headers:"
cat /tmp/registry-headers.txt || true
echo "Body:"
cat /tmp/registry-body.txt || true
- name: Try docker/login-action
id: login_action
continue-on-error: true
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Show action result
if: always()
shell: bash
run: |
set -eu
echo "LOGIN_ACTION_OUTCOME=${{ steps.login_action.outcome }}"
echo "LOGIN_ACTION_CONCLUSION=${{ steps.login_action.conclusion }}"
- name: Try direct docker login
if: always()
shell: bash
run: |
set +e
printf '%s' '${{ secrets.REGISTRY_PASSWORD }}' | docker login "${{ vars.REGISTRY }}" \
--username '${{ secrets.REGISTRY_USERNAME }}' \
--password-stdin > /tmp/docker-login.out 2>&1
status=$?
set -e
echo "DOCKER_LOGIN_EXIT_CODE=$status"
cat /tmp/docker-login.out
exit 0