Ssh: command not found

I’m trying to deploy to a python app to an EC2 server by executing a deployment script via ssh like so:

deployment:
  master:
     branch: master
     commands:
       - source ./environment_variables.sh && \
         /usr/bin/ssh -i /home/ubuntu/.ssh/id_production ubuntu@$SSH_HOST "/var/www/mls_api/atomic_deployments.sh"

But the ssh command doesn’t seem to be installed. I get this error:

bash: line 1: ssh: command not found

At first I thought this might be an issue related to virtualenv, but using /usr/bin/ssh returns the same error. Is deploying this way possible?

Edit: The culprit turned out to be the \ after the &&. Apparently, CircleCI doesn’t share that convention with bash.

The culprit turned out to be the \ after the &&. Apparently, CircleCI doesn’t share that convention with bash.

1 Like

It’s the way YAML parses strings. More information on the various ways to do multiline strings in YAML can be found here: http://stackoverflow.com/questions/3790454/in-yaml-how-do-i-break-a-string-over-multiple-lines

Another option would be a single deploy script.

2 Likes

Gotcha, thanks @FelicianoTech!

1 Like