Issue
Excerpt from a CircleCI config file:
deploy:
machine:
enabled: true
steps:
- run:
name: AWS EC2 deploy
command: |
ssh -o "StrictHostKeyChecking no" [email protected] "cd ~/circleci-aws; git pull; npm i; npm run build; pm2 restart build/server
How can I break the command into multiple lines? Tried below syntax, but it only runs the first command:
deploy:
machine:
enabled: true
steps:
- run:
name: Deploy
command: |
ssh -o StrictHostKeyChecking=no [email protected]
cd ~/circleci-aws
git pull
npm i
npm run build
pm2 restart build/server
Solution
You'll need to pass those other commands as args to a shell (like bash
):
ssh -o StrictHostKeyChecking=no [email protected] bash -c '
cd ~/circleci-aws
git pull
npm i
npm run build
pm2 restart build/server'
Answered By - dnephin Answer Checked By - Timothy Miller (WPSolving Admin)