Update .gitea/workflows/build-and-push.yaml
All checks were successful
Build and Push Container Image / build-and-push (push) Successful in 5s

This commit is contained in:
2026-04-27 12:03:30 +00:00
parent 2b7861c1cf
commit 505d255547

View File

@@ -7,10 +7,6 @@ on:
tags:
- "v*"
env:
# Internal Gitea service URL — bypasses nginx, avoids /v2/ routing issue
INTERNAL_REGISTRY: gitea-http.gitea.svc.cluster.local:3000
jobs:
build-and-push:
runs-on: orchestration-platform
@@ -21,7 +17,6 @@ jobs:
- name: Install tools
run: |
apk add --no-cache git curl
curl -sL https://github.com/google/go-containerregistry/releases/latest/download/go-containerregistry_Linux_x86_64.tar.gz | tar -xz -C /usr/local/bin crane
- name: Checkout code
run: |
@@ -39,13 +34,25 @@ jobs:
- name: Build image
run: |
IMAGE="${INTERNAL_REGISTRY}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
docker build -t "${IMAGE}" .
docker save "${IMAGE}" -o image.tar
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
id: build
- name: Push image
# TODO: Registry push is currently blocked.
# The Gitea ingress only routes /gitea/ to the backend; the Docker registry
# API (/v2/) returns 404 from nginx. A separate Ingress rule for /v2 -> gitea-http:3000
# (without rewrite-target) is needed before push can work.
- name: Push image (skipped - registry ingress not configured)
run: |
REGISTRY_HOST=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
IMAGE="${REGISTRY_HOST}/${{ gitea.repository }}:${{ steps.meta.outputs.tag }}"
crane auth login "${REGISTRY_HOST}" -u "${{ gitea.actor }}" -p "${{ secrets.REGISTRY_TOKEN }}"
crane push image.tar "${IMAGE}"
echo "⚠️ Skipping push: Gitea container registry is not reachable."
echo " The ingress does not route /v2/ to Gitea (returns 404 from nginx)."
echo " Fix: Add a separate Ingress for path /v2 pointing to gitea-http:3000 without rewrite-target."
echo ""
echo " Image built successfully: ${IMAGE}"
echo " To push manually once ingress is fixed:"
echo " crane auth login \${REGISTRY_HOST} -u <user> -p <token>"
echo " crane push image.tar \${IMAGE}"