ci: write the ssh config where ssh reads it !5
1 file changed, +5 −2
Layout: unified · split
.gitbay/ci.yml +5 −2
| @@ -22,8 +22,11 @@ jobs: | ||
| 22 | 22 | test -n "$GITBAY_SSH" || { echo "ERROR: GITBAY_SSH is not set; the runner is too old"; exit 1; } |
| 23 | 23 | umask 077 |
| 24 | 24 | printf '%s\n' "$BOT_SSH_KEY" > "$PWD/.bot_key" |
| 25 | mkdir -p ~/.ssh | |
| 26 | printf 'Host %s\n IdentityFile %s\n IdentitiesOnly yes\n StrictHostKeyChecking accept-new\n' "${GITBAY_SSH#*@}" "$PWD/.bot_key" > ~/.ssh/config | |
| 25 | # ssh expands ~ from the passwd entry, not $HOME; in the build's | |
| 26 | # container that is /root while $HOME is the build home. | |
| 27 | sshhome=$(getent passwd "$(id -u)" | cut -d: -f6) | |
| 28 | mkdir -p "$sshhome/.ssh" | |
| 29 | printf 'Host %s\n IdentityFile %s\n IdentitiesOnly yes\n StrictHostKeyChecking accept-new\n' "${GITBAY_SSH#*@}" "$PWD/.bot_key" > "$sshhome/.ssh/config" | |
| 27 | 30 | ssh "$GITBAY_SSH" whoami |
| 28 | 31 | - | |
| 29 | 32 | set -e |