Reputation: 1317
I'm using gitlab CI to deploy my project on virtuals machines through SSH. Some of virtuals machines can be off at the moment of my deploy so my job fail when I can't reach one of these vm.
Here what I'm doing in my ci
- ssh -o StrictHostKeyChecking=no user@vm1 "mkdir -p /myproject/releases/$CI_COMMIT_TAG"
- ssh -o StrictHostKeyChecking=no user@vm1 "mkdir -p /myproject/releases/$CI_COMMIT_TAG/dev"
- rsync -az * user@vm1:/myproject/releases/$CI_COMMIT_TAG
At the first ssh command, I have this error :
ssh: connect to host vm1 port 22: Connection timed out ERROR: Job failed: exit status 1
How can I ignore SSH timeout to continue my gitlab ci ?
The best solution to me could be :
If the vm doesn't "answer" about 20 seconds, ignore it and try to deploy to the next vm.
Thank you very much :)
EDIT : I've got the same problem with rsync of course...
Upvotes: 1
Views: 697
Reputation: 1317
The best solution for my problem is a bash script.
Upvotes: 0
Reputation: 8781
You can try adding a || true
after each ssh
to always return something which Travis will not interpret as an error, but would also wait until the command is done.
Upvotes: 1