Files
gitea-dynamic-runner/scripts/gitea-job-started
T
panxiao81 4277bd907a
test / python (pull_request) Successful in 9s
test / shell (pull_request) Successful in 15s
实现一次性 Pod Runner 后端
2026-09-16 14:26:07 +00:00

20 lines
487 B
Bash

#!/bin/sh
set -eu
socket=${SPIRE_AGENT_SOCKET:-/run/spire/agent-sockets/spire-agent.sock}
wait_seconds=${SPIFFE_IDENTITY_WAIT_SECONDS:-60}
deadline=$(( $(date +%s) + wait_seconds ))
while [ "$(date +%s)" -lt "$deadline" ]; do
if timeout 2 /opt/spire/bin/spire-agent api fetch jwt \
-audience ci-job-ready \
-socketPath "$socket" \
>/dev/null 2>&1; then
exit 0
fi
sleep 1
done
echo "timed out waiting for the job SPIFFE identity" >&2
exit 1