@senior: Wire up ssh node1 … in the agent workflow (read-only swarm diagnostics)
#11
@@ -130,6 +130,39 @@ jobs:
|
|||||||
}' > ~/.config/opencode/opencode.json
|
}' > ~/.config/opencode/opencode.json
|
||||||
echo "opencode config (secrets masked):"; cat ~/.config/opencode/opencode.json
|
echo "opencode config (secrets masked):"; cat ~/.config/opencode/opencode.json
|
||||||
|
|
||||||
|
- name: Set up read-only SSH alias `node1` (swarm diagnostics)
|
||||||
|
# Writes the deploy key + an SSH config alias so the agent can run
|
||||||
|
# `ssh node1 <read-only cmd>` (matches the homelab opencode.json allowlist).
|
||||||
|
# No-ops cleanly when the swarm secrets are absent — this shared workflow
|
||||||
|
# runs in repos that don't have SWARM_HOST/SWARM_USER/SSH_PRIV_KEY, and
|
||||||
|
# must not fail there. Secrets are passed via env (never inlined in shell).
|
||||||
|
env:
|
||||||
|
SWARM_HOST: ${{ secrets.SWARM_HOST }}
|
||||||
|
SWARM_USER: ${{ secrets.SWARM_USER }}
|
||||||
|
SSH_PRIV_KEY: ${{ secrets.SSH_PRIV_KEY }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$SWARM_HOST" ] || [ -z "$SWARM_USER" ] || [ -z "$SSH_PRIV_KEY" ]; then
|
||||||
|
echo "swarm secrets not set in this repo — skipping node1 SSH alias"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||||
|
# Write the private key with 600 perms; never echo its contents.
|
||||||
|
printf '%s\n' "$SSH_PRIV_KEY" > ~/.ssh/agent_node1
|
||||||
|
chmod 600 ~/.ssh/agent_node1
|
||||||
|
# SSH config alias `node1` — last-match-wins in the homelab opencode allowlist
|
||||||
|
# (`deny ssh *` + specific `allow ssh node1 …`), so the alias name is fixed.
|
||||||
|
cat > ~/.ssh/config <<EOF
|
||||||
|
Host node1
|
||||||
|
HostName $SWARM_HOST
|
||||||
|
User $SWARM_USER
|
||||||
|
IdentityFile ~/.ssh/agent_node1
|
||||||
|
IdentitiesOnly yes
|
||||||
|
StrictHostKeyChecking accept-new
|
||||||
|
ConnectTimeout 10
|
||||||
|
EOF
|
||||||
|
chmod 600 ~/.ssh/config
|
||||||
|
echo "node1 SSH alias configured (host=$SWARM_HOST user=$SWARM_USER)"
|
||||||
|
|
||||||
- name: Inspect / fetch image attachments (download only for vision agents)
|
- name: Inspect / fetch image attachments (download only for vision agents)
|
||||||
id: imgs
|
id: imgs
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user