ci: push the image with crane (plain-HTTP in-cluster registry)
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 1m5s
ci / test (pull_request) Successful in 7m15s
ci / build (pull_request) Successful in 2m25s
ci / image (pull_request) Successful in 28s

On main and tags GITHUB_SERVER_URL is http://gitea-http.gitea.svc...,
and the runner's Docker daemon refused to push there: "server gave HTTP
response to HTTPS client". crane pushes the saved image with --insecure
for http:// servers and tags the channels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-05 18:02:53 +01:00
1 parent 220bc5f3d8
commit 266dec50de
1 file changed
+18 -4
+18 -4
View File
@@ -289,7 +289,7 @@ jobs:
image: image:
# Builds Dockerfile.ci (the build job's amd64 binaries on distroless) # Builds Dockerfile.ci (the build job's amd64 binaries on distroless)
# with the runner's Docker daemon instead of Kaniko rebuilding frontend # with the runner's Docker daemon and pushes with crane instead of Kaniko rebuilding frontend
# and Go from the git context. Images are pushed only from main and tags, # and Go from the git context. Images are pushed only from main and tags,
# and only once the PACKAGE_TOKEN secret (write:package) exists. # and only once the PACKAGE_TOKEN secret (write:package) exists.
# The build job's version, so the API reports the release its agent # The build job's version, so the API reports the release its agent
@@ -313,7 +313,7 @@ jobs:
VERSION: ${{ needs.build.outputs.version }} VERSION: ${{ needs.build.outputs.version }}
run: | run: |
set -eu set -eu
apk add --no-cache docker-cli docker-cli-buildx >/dev/null apk add --no-cache docker-cli docker-cli-buildx crane >/dev/null
REGISTRY="${GITHUB_SERVER_URL#*://}" REGISTRY="${GITHUB_SERVER_URL#*://}"
IMAGE="$(printf '%s/%s' "$REGISTRY" "$GITHUB_REPOSITORY" | tr 'A-Z' 'a-z')" IMAGE="$(printf '%s/%s' "$REGISTRY" "$GITHUB_REPOSITORY" | tr 'A-Z' 'a-z')"
TAG="$VERSION" TAG="$VERSION"
@@ -338,7 +338,21 @@ jobs:
echo "PACKAGE_TOKEN is not set; built without pushing." echo "PACKAGE_TOKEN is not set; built without pushing."
exit 0 exit 0
fi fi
printf '%s' "$PACKAGE_TOKEN" | docker login "$REGISTRY" -u "$GITHUB_ACTOR" --password-stdin # crane instead of docker push: on main and tags GITHUB_SERVER_URL is
for t in $TAGS; do docker push "$t"; done ;; # the in-cluster plain-HTTP address, which the runner's Docker
# daemon refuses ("server gave HTTP response to HTTPS client").
INSECURE=""
case "$GITHUB_SERVER_URL" in http://*) INSECURE="--insecure" ;; esac
printf '%s' "$PACKAGE_TOKEN" | crane auth login "$REGISTRY" -u "$GITHUB_ACTOR" --password-stdin $INSECURE
FIRST=""
for t in $TAGS; do
if [ -z "$FIRST" ]; then
docker save "$t" -o /tmp/image.tar
crane push $INSECURE /tmp/image.tar "$t"
FIRST="$t"
else
crane tag $INSECURE "$FIRST" "${t##*:}"
fi
done ;;
*) echo "Pull request: built without pushing." ;; *) echo "Pull request: built without pushing." ;;
esac esac