Hello,
I'm using bitbucket pipeline for deploying my application on my server.
In my pipeline script i connect on my server with ssh and run a bash script on it,
Everything look's to be ok, but after the bash script exit (with a 0, cause of success), nothing happens, the pipeline keep "processed", doing nothing, instead of ending with a success.
What i missing ? how the pipeline script can catch the end of the bash script ?
Here is my pipeline script :
image: samueldebruyn/debian-git
pipelines: branches: develop:
- step: caches:
- node script:
- apt-get update
- apt-get install -y unzip
- apt-get -qq install git-ftp
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD $FTP_HOST_DEV
- ssh -tt $SSH_HOST 'bash -s' < deploy.bash
Here is my bash script :
#!/bin/bashcd
/path/to/my/folder
npm install
pm2 restart developement
exit $?
thank you !
(sorry for my english)
Try dropping the < in your ssh call
ssh -tt $SSH_HOST 'bash -s' < deploy.bash
ssh -tt $SSH_HOST deploy.bash
Hello,
i've tried
ssh -tt 'bash -s' $SSH_HOST deploy.bash
same issue, the difference is, the console don't return anything of what happened on the server, but keep runing forever
and i've tried
ssh -tt $SSH_HOST deploy.bash
he throw me an error :
+ ssh -tt $SSH_HOST deploy.bash
bash: deploy.bash: command not found
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the script located on the target server?
If not, you can try running it as such
ssh $SSH_HOST << EOF
npm install
pm2 restart development
EOF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it drive me crazy
still have the same issue, he keep runing on the last command, "EOF".
ssh is ok, cd, nmp install, and pm2 are ok too, but he process forever on the last command "EOF"
i really don't get it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The EOF just creates a section where you can send multiple commands to the server, so that shouldn't cause any problems.
Can you access the server directly and run each command in turn to see if one is causing an issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok so, i juste add an exit $? before de last EOF and it work
here is the code :
image: samueldebruyn/debian-git
pipelines:
branches:
develop:
- step:
caches:
- node
script:
- apt-get update
- apt-get install -y unzip
- apt-get -qq install git-ftp
- git ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD $FTP_HOST_DEV
- ssh -tt $SSH_HOST << EOF
- cd $FTP_HOST_DEV
- npm install
- pm2 restart developement
- exit $?
- EOF
so, thank you !
you save my night, i can sleep in peace now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i just realise he stop at the exit, so he don't run the last EOF, i'm not really sur if it's a problem or not...
by the way, when i run every command on my server, everything work correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to clarify, where you have the two EOF in the command file it is acting as a script wrapper, so each line in between the EOFs is run (not the actual EOF itself)
Similar to a do loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.