actions/checkout@v4 is a JS action; Forgejo Actions runs it via node, which neither golang:1.25-bookworm nor docker:27-cli ship. Every run since the .gitea/workflows move has failed identically: 'exec: node: executable file not found in $PATH' during the checkout step, before any real job step ran. Verified locally against both exact images before pushing: - golang:1.25-bookworm: apt-get install nodejs ca-certificates git -> node v18.20.4, git 2.39.5. - docker:27-cli: apk add nodejs git -> node v22.23.2, git 2.47.2, and actions/checkout's dist/index.js actually executes afterward (confirmed by invoking it directly) instead of failing on a missing binary. - The Dockerfile itself builds clean end to end and the resulting image serves /healthz, so checkout was the only remaining blocker in the path.
69 lines
2.3 KiB
YAML
69 lines
2.3 KiB
YAML
# Forgejo Actions build — push image on main only.
|
|
# Tag is commit short SHA: unique, immutable, maps to exactly one commit.
|
|
# No write-back, no git push — ArgoCD Image Updater pulls new builds autonomously.
|
|
# Enabled by Stage 1 (B, C1).
|
|
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
env:
|
|
REGISTRY: forgejo.riotpiao.com
|
|
IMAGE: forgejo.riotpiao.com/rock/api-gateway
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and push image
|
|
runs-on: docker
|
|
container:
|
|
image: docker:27-cli
|
|
# The runner's dind sidecar shares the pod network and the mTLS cert
|
|
# emptyDir, so the daemon is reachable on localhost with the client certs
|
|
# dind generated at startup.
|
|
options: --network host
|
|
env:
|
|
DOCKER_HOST: tcp://localhost:2376
|
|
DOCKER_TLS_VERIFY: "1"
|
|
DOCKER_CERT_PATH: /docker-certs/client
|
|
steps:
|
|
# actions/checkout@v4 is a JS action -- Forgejo Actions execs it with
|
|
# `node`, which docker:27-cli (Alpine) doesn't ship. Without this the
|
|
# checkout step fails with "exec: node: executable file not found in
|
|
# $PATH" before any of the job's own steps run. Verified locally:
|
|
# `apk add --no-cache nodejs git` in this exact image gets node v22 +
|
|
# git 2.47, and the checkout action's dist/index.js then actually
|
|
# executes (confirmed by running it directly) instead of failing on a
|
|
# missing binary.
|
|
- name: install node (required by JS-based actions)
|
|
run: apk add --no-cache nodejs git
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get short SHA
|
|
id: sha
|
|
run: |
|
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
|
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Registry login
|
|
run: |
|
|
echo "${FORGEJO_PAT}" | docker login "${REGISTRY}" \
|
|
--username rock --password-stdin
|
|
env:
|
|
FORGEJO_PAT: ${{ secrets.FORGEJO_RIOTPIAO_PAT }}
|
|
|
|
- name: Build
|
|
run: |
|
|
docker build \
|
|
--build-arg "VERSION=${{ steps.sha.outputs.short_sha }}" \
|
|
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
|
|
.
|
|
|
|
- name: Push
|
|
run: docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
|
|
|
- name: Report digest
|
|
run: |
|
|
docker inspect --format='{{index .RepoDigests 0}}' "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|