I want to locally run a job to deploy my current project. For that I use environment variables with secrets to provide the SSH key of the remote server:
kind: pipeline type: docker name: default steps: - name: deploy image: node:10.15.3 environment: SSH_KEY: from_secret: ssh_key commands: - npm install --silent - npm install -g @angular/cli --silent - ng build --prod - echo "$SSH_KEY" > key - cd dist - scp -i /drone/src/key -P [my_ssh_port] -r * [my_user]@[host]
I have tested the env var and it’s correctly creating a key with the correct content within the container.
The problem comes with the scp command, it outputs:
[deploy:25] Host key verification failed.
[deploy:26] lost connection
I have run the same command in my local computer and it successfully connects to the server and copies the files, but for some reason from within the container that doesn’t happen.
I run the file with the following command:
sudo drone exec --secret-file [path_to_secret]
Is there something wrong in the file?