diff --git a/Jenkinsfile b/Jenkinsfile index 956c454c..321fead5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -248,19 +248,20 @@ pipeline { ) ]) { script { + def devHost = env.DEV_SERVER_HOST?.trim() + def knownHostsFile = "${env.WORKSPACE}/.jenkins-anexo76-known_hosts" sh """ set -euo pipefail - mkdir -p ~/.ssh - chmod 700 ~/.ssh - ssh-keyscan -T 15 -H '${env.DEV_SERVER_HOST}' >> ~/.ssh/known_hosts + ssh-keyscan -T 15 -H '${devHost}' > '${knownHostsFile}' """ def remote = [ name: 'dev-server', - host: env.DEV_SERVER_HOST, + host: devHost, user: env.DEV_SERVER_USER ?: env.DEV_SERVER_SSH_USER, identityFile: env.DEV_SERVER_KEY, passphrase: env.DEV_SERVER_KEY_PASSPHRASE, - allowAnyHosts: false + allowAnyHosts: false, + knownHosts: knownHostsFile ] sshCommand remote: remote, command: ''' set -euo pipefail