diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5656a5d8f458b45ed062ff808aa25f5c8142d9c9..4472c4f8d7c1ff9f71cfead2dd4368136700478e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,24 @@ ubuntu:18.04 before_script: - apt-get update -qy - apt-get install -y lftp + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' + + - eval $(ssh-agent -s) + + ## + ## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store + ## We're using tr to fix line endings which makes ed25519 keys work + ## without extra base64 encoding. + ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556 + ## + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + + ## + ## Create the SSH directory and give it the right permissions + ## + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh build: script: - - lftp -e 'set sftp:connect-program "ssh -a -x -i $PRIVATE_KEY"; connect sftp://aeiie@perso.iiens.net; mirror -X .* -X .*/ --reverse --verbose --delete bde.iiens.net/ /home/users/assoces/aeiie/html/web/test; UpdateFinished' + - lftp -e 'set sftp:connect-program "ssh -a -x -i $PRIVATE_KEY"; connect sftp://aeiie@perso.iiens.net; mirror -X .* -X .*/ --reverse --verbose --delete bde.iiens.net/ /home/users/assoces/aeiie/html/web/test; UpdateFinished'