From 9c69391f9504fa863e4ad7db42a0a55a07b85f85 Mon Sep 17 00:00:00 2001 From: wolves Date: Sat, 14 Mar 2026 20:20:19 +0800 Subject: [PATCH] add test workflow --- .gitea/workflows/test.yml | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .gitea/workflows/test.yml diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..5a2c1e7 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -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