File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ RUN apk add bash git curl sshpass openssh-client gettext && \
44 curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/c86fd9a89b14471d1a4e3cdfd2c4483a26f89379/mo -o /usr/local/bin/mo && \
55 chmod +x /usr/local/bin/mo
66
7+ COPY load_ssh_private_key /usr/local/bin
Original file line number Diff line number Diff line change @@ -10,5 +10,21 @@ Features:
1010 * mo (mustache templates written in bash https://github.com/tests-always-included/mo )
1111 * sshpass
1212 * openssh-client
13+ * load_ssh_private_key
1314
1415This image can be usefull in Gitlab CI where impossible to prepare and cache docker image for builds.
16+
17+ ## load_ssh_private_key tool
18+
19+ Loads provided SSH private key with ` ssh-agent ` . This tool is useful for deploying artifacts to the remote host with ` ssh ` .
20+
21+ Usage:
22+ ```
23+ load_ssh_private_key ${SSH_PRIVATE_KEY}
24+ ```
25+
26+ or
27+ ```
28+ export SSH_PRIVATE_KEY="xxx"
29+ load_ssh_private_key
30+ ```
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ SSH_PRIVATE_KEY=${SSH_PRIVATE_KEY:- $1 }
4+
5+ if [ -z " ${SSH_PRIVATE_KEY} " ]; then
6+ echo " Usage: load_ssh_private_key <SSH_PRIVATE_KEY>"
7+ exit 1
8+ fi
9+
10+ eval $( ssh-agent -s)
11+ echo " ${SSH_PRIVATE_KEY} " | tr -d ' \r' | ssh-add -
12+ mkdir -p ~ /.ssh
13+ chmod 700 ~ /.ssh
14+ echo -e " Host *\n\tStrictHostKeyChecking no\n\n" > ~ /.ssh/config
You can’t perform that action at this time.
0 commit comments