feat: integrated the git-ssh-sign kit into the coyote sandbox kit
CI / All (ubuntu-latest) (push) Failing after 26s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-08-04 10:56:50 -06:00
parent fac577589b
commit e76c3efe4e
2 changed files with 62 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
if [ -z "$SSH_AUTH_SOCK" ]; then
echo "WARNING: [git-ssh-sign] no SSH agent — cannot sign commits"
fi
KEY=$(ssh-add -L 2>/dev/null | head -1)
if [ -z "$KEY" ]; then
echo "WARNING: [git-ssh-sign] no keys in SSH agent — cannot sign commits"
fi
KEY_FILE="/home/agent/.config/git/signing_key.pub"
mkdir -p "$(dirname "$KEY_FILE")"
printf '%s\n' "$KEY" > "$KEY_FILE"
EMAIL=$(git config user.email 2>/dev/null || echo "agent@sandbox.local")
printf '%s %s\n' "$EMAIL" "$KEY" > "/home/agent/.config/git/allowed_signers"
local_hook="$(git rev-parse --git-dir)/hooks/pre-commit"
if [ -x "$local_hook" ]; then
exec "$local_hook" "$@"
fi
+41
View File
@@ -238,6 +238,47 @@ environment:
- ZHIPUAI_API_KEY - ZHIPUAI_API_KEY
commands: commands:
initFiles:
- path: /home/agent/.config/git/ssh-signing-key-command
mode: '0755'
description: Resolve the forwarded SSH agent key for Git SSH signing
content: |
#!/bin/sh
set -e
if [ -z "$SSH_AUTH_SOCK" ]; then
echo "WARNING: [git-ssh-sign] no SSH agent - cannot sign commits" >&2
fi
key=$(ssh-add -L 2>/dev/null | head -n 1)
if [ -z "$key" ]; then
echo "WARNING: [git-ssh-sign] no keys in SSH agent - cannot sign commits" >&2
fi
config_dir="$GIT_SSH_SIGN_CONFIG_DIR"
if [ -z "$config_dir" ]; then
config_dir="/home/agent/.config/git"
fi
mkdir -p "$config_dir"
email=$(git config user.email 2>/dev/null || printf '%s' "agent@sandbox.local")
printf '%s %s\n' "$email" "$key" > "$config_dir/allowed_signers"
printf 'key::%s\n' "$key"
install:
- command: |
git config --system gpg.format ssh
git config --system --unset-all user.signingKey || true
git config --system commit.gpgSign true
git config --system tag.gpgSign true
git config --system gpg.ssh.defaultKeyCommand /home/agent/.config/git/ssh-signing-key-command
git config --system gpg.ssh.allowedSignersFile /home/agent/.config/git/allowed_signers
if [ "$(git config --system --get core.hooksPath || true)" = "/home/agent/.config/git/hooks" ]; then
git config --system --unset-all core.hooksPath
fi
user: '0'
description: Configure SSH commit signing with a dynamic key command
startup: startup:
- command: - command:
[ [