Hi there,
if I missed a rule posting this here, sorry, I tried to find the right place and hope I am correct.
I am trying to deploy a jar file on a remote server with the CI/CD pipeline. Uploading the file with scp works totally fine. No I want to run a remote shell script, killing the old process and starting the new one.
My deploy stage looks as follows:
deploy_stage:
stage: deploy
image: ubuntu:latest
environment: Staging
script:
- apt-get update -qq && apt-get install -y -qq sshpass
- sshpass -V
- export SSHPASS=$USER_PASS
- sshpass -e ssh devopslab@xxx.com '/home/devopslab/xxx/stop.sh'
- sshpass -e scp -o stricthostkeychecking=no -r ./target/*.jar devopslab@xxx.com:/home/devopslab/xxx
- sshpass -e ssh devopslab@xxx.com 'home/devopslab/xxx/start.sh'
The stop.sh script e.g. looks as follows:
#!/bin/sh
nohup kill -9 `cat /home/devopslab/zuul/zuul.pid` >/dev/null 2>&1 &
Everything works fine, when calling it locally. But as soon, as I call the script via gitlab ci/cd it fails with the following message:
Using "assword" as the default password prompt indicator.
$ export SSHPASS=$USER_PASS
$ sshpass -e ssh devopslab@xxx.com '/home/devopslab/xxx/stop.sh'
ERROR: Job failed: exit code 1
Anyone got an idea?
Thanks upfront!