I'm trying to use the SSH deploy task in Azure devops, but I'm struggling to get it to work.
Steps:
- I generated a ssh-key
- The key is added to the server
- (optional) tested key locally (works)
- Created a Service connection in Azure Devops (with the private key data and the passfrase in the password field)
- Allow the correct pipeline in Service connection security
- Added the SSH task to the release pipeline.
- Added an inline script.
Connection succeeds
It seems to connect but doesn't execute the commands. I've checked the /var/log/auth.log
file on the server and that does show a successfull connection. The authentication log on the remote server does show a successfull authentication from devops, the connects lasts exactly the value set for the timeout.
Wrong order, logging shows commands then connected
In the logging it shows my second (docker-compose pull
) and third command (docker-compose up -d
) but not the first command. And the commands are shown before the trying to connect line. The first command isn't shown at all.
Did I make a mistake or is their something else going on?
Here is the logging of the task
2020-02-12T15:05:23.7258315Z ##[section]Starting: Run SSH
2020-02-12T15:05:23.8777631Z ==============================================================================
2020-02-12T15:05:23.8778469Z Task : SSH
2020-02-12T15:05:23.8778560Z Description : Run shell commands or a script on a remote machine using SSH
2020-02-12T15:05:23.8778657Z Version : 0.151.1
2020-02-12T15:05:23.8778735Z Author : Microsoft Corporation
2020-02-12T15:05:23.8778839Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh
2020-02-12T15:05:23.8778953Z ==============================================================================
2020-02-12T15:05:24.5860676Z docker-compose pull
2020-02-12T15:05:24.5860824Z docker-compose up -d
2020-02-12T15:05:24.5861194Z Trying to establish an SSH connection to ***@my-server.domain.com:22
2020-02-12T15:05:25.4787782Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4789160Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4791265Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4791477Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792286Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792439Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792552Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792648Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792757Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792851Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4792960Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.4793055Z (node:4364) Warning: Use Cipheriv for counter mode of aes-256-ctr
2020-02-12T15:05:25.7447781Z Successfully connected.
2020-02-12T15:05:25.7564295Z ##[error]Unhandled: Cannot parse privateKey: Unsupported key format
2020-02-12T15:09:23.7874932Z ##[error]The task has timed out.
2020-02-12T15:09:23.7877908Z ##[section]Finishing: Run SSH
Task YAML
- task: SSH@0
displayName: 'Run remote docker-compose commands'
inputs:
sshEndpoint: 'Endpoint name redacted'
runOptions: inline
inline: |
cd ~/correct-folder/
docker-compose pull
docker-compose up -d
timeoutInMinutes: 4
I've tried both Windows and Ubuntu hosted agents.
Unrelated issues that show same error:
- https://github.com/microsoft/azure-pipelines-tasks/issues/12147
- Node Cipheriv Warning in Azure DevOps Extension - Release Task
- Issue on with node https://github.com/nodejs/node/issues/16746
Same issue, with explaination
https://stackoverflow.com/a/55093077/639153
It seems like the Task library is calling the wrong node function, as "solved" in march '19.