Skip to content

Commit 6d6fd6b

Browse files
authored
ci: Write CI SSH key into file (#630)
API has changed. It requires a file path
2 parents 608ff05 + 516c517 commit 6d6fd6b

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.7
1+
1.3.8

ci/install-package.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ then
108108

109109
if [[ "$(ssh-add -l)" != *"${SSH_KEY_FINGERPRINT}"* ]]
110110
then
111-
{ [[ "$(ssh-add "${SSH_KEY}" &> /dev/null)" ]] && SSH_KEY_CHECK="true"; } || { echo "'${SSH_KEY}' is an invalid SSH key" && exit 1; }
111+
{ ssh-add "${SSH_KEY}" &> /dev/null && SSH_KEY_CHECK="true"; } || { echo "'${SSH_KEY}' is an invalid SSH key" && exit 1; }
112112

113113
else
114114
SSH_KEY_CHECK="true"
@@ -181,10 +181,12 @@ mkdir -p "$HOME"/.ccache
181181
docker run --detach --interactive --tty -e CI="true" -e PACKAGE="$PACKAGE" -e BRANCH="$BRANCH" -e COMMIT="$COMMIT" -e PULL_REQUEST="$PULL_REQUEST" -e REF_NAME="$REF_NAME" --name tue-env --mount type=bind,source=$HOME/.ccache,target=$DOCKER_HOME/.ccache $DOCKER_MOUNT_KNOWN_HOSTS_ARGS "$IMAGE_NAME:$BRANCH_TAG"
182182

183183
# Own the ~/.ccache folder for permissions
184-
docker exec -t tue-env bash -c "sudo chown 1000:1000 -R ~/.ccache"
184+
docker exec -t tue-env bash -c 'sudo chown "${USER}":"${USER}" -R ~/.ccache'
185185

186186
if [ "$USE_SSH" == "true" ]
187187
then
188+
docker exec -t tue-env bash -c 'sudo chown "${USER}":"${USER}" -R /tmp/.ssh'
189+
188190
docker exec -t tue-env bash -c "[[ -f /tmp/.ssh/known_hosts ]] && mv ~/.ssh/known_hosts ~/.ssh/known_hosts_container"
189191
docker exec -t tue-env bash -c 'sudo cp -r /tmp/.ssh/* ~/.ssh/ && sudo chown -R "${USER}":"${USER}" ~/.ssh && ls -aln ~/.ssh'
190192

ci/main/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ runs:
4242
if [[ -n "${SSH_KEY}" ]]
4343
then
4444
SSH_ARG="--ssh"
45-
SSH_KEY_ARG="--ssh-key=${SSH_KEY}"
45+
mkdir -p "${HOME}"/.ssh
46+
echo "${SSH_KEY}" > "${HOME}"/.ssh/ci_ssh_key
47+
SSH_KEY_ARG="--ssh-key=${HOME}/.ssh/ci_ssh_key"
4648
fi
4749
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
4850
then

0 commit comments

Comments
 (0)