chore(build-and-push): add fail-fast SSH probe to remote builder host
Surfaces the real reachability/auth error instead of buildx's slow 'context deadline exceeded' when the runner can't reach the daemon.
This commit is contained in:
@@ -64,12 +64,22 @@ runs:
|
|||||||
env:
|
env:
|
||||||
SSH_KEY: ${{ inputs.ssh_key }}
|
SSH_KEY: ${{ inputs.ssh_key }}
|
||||||
BUILDER_HOST: ${{ inputs.docker_host }}
|
BUILDER_HOST: ${{ inputs.docker_host }}
|
||||||
|
BUILDER_USER: ${{ inputs.docker_user }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${SSH_KEY}" > ~/.ssh/id_ed25519
|
echo "${SSH_KEY}" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
ssh-keyscan "${BUILDER_HOST}" >> ~/.ssh/known_hosts
|
ssh-keyscan "${BUILDER_HOST}" >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
# Fail fast with a real diagnostic instead of a slow buildx
|
||||||
|
# "context deadline exceeded" if the runner can't reach / auth to the
|
||||||
|
# remote docker daemon over SSH.
|
||||||
|
echo "== probing ssh://${BUILDER_USER}@${BUILDER_HOST} =="
|
||||||
|
ssh -o BatchMode=yes -o ConnectTimeout=10 \
|
||||||
|
-i ~/.ssh/id_ed25519 \
|
||||||
|
"${BUILDER_USER}@${BUILDER_HOST}" \
|
||||||
|
'docker version --format "server={{.Server.Version}}"'
|
||||||
|
|
||||||
- name: Set up remote Docker Buildx builder
|
- name: Set up remote Docker Buildx builder
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user