Hi! I’m trying to use CircleCI to deploy a project into different branches. I got it work at my first test, but now with the real project and its propers files, I don’t know why, is not working anymore and I don’t get any error in the build… I’m using this following code:
version: 2
jobs:
build_and_staging:
docker:
- image: circleci/node:4.8.2
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "11:a8:0b:d4:5b:d8:50:a0:c1:14:71:15:14:c5:ea:54"
- run:
name: ssh connection within bash script
command: bash ./deploy_staging.sh
build_and_production:
docker:
- image: circleci/node:4.8.2
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "11:a8:0b:d4:5b:d8:50:a0:c1:14:71:15:14:c5:ea:54"
- run:
name: ssh connection within bash script
command: bash ./deploy_production.sh
workflows:
version: 2
build-and-deploy:
jobs:
- build_and_staging:
filters:
branches:
only: staging
- build_and_production:
filters:
branches:
only: production
Here is my bash script called deploy_staging.sh
#!/usr/bin/env bash
cat >> ~/.ssh/config << EOF
VerifyHostKeyDNS yes
StrictHostKeyChecking no
EOF
echo "copying latest version of the code to our server"
sudo apt-get install sshpass
sshpass -p "PaSsWoRd" scp -r ubuntu@xxx.xxx.xxx.xxx:staging/my-path/
exit 0
Some images that of the CircleCI build…
Any idea of why it stops working or if there is something to improve? Thanks in advance, it’s quite frustrating.