For a bitbucket pipeline I'm using the following after-script
:
after-script:
- |-
ssh -tt -p 222 user@example.com "/bin/bash" << EOF
cd public_html/staging && npm i && pm2 delete my-app || : && VITE_BASE_URL=$VITE_BASE_URL pm2 -f start build/index.js --update-env --name my-app
EOF
Here I do the following:
Now for step 6 it doesn't work as expected. The process doesn't stop and the pipeline keeps running.
I assume I made some kind of syntax mistake, but I can't figure out what I did wrong.
best regards
EDIT 1:
When removing the flag -tt
I get the following errors:
/bin/bash: line 1: npm: command not found
/bin/bash: line 1: pm2: command not found
I don't think there is anything I can do about that, since I am not able to change the servers settings
removing the last EOT
in the code, causes this error to pop up, while the process doesn't finish:
schwad@dedivirt2847:~/public_html/staging$ printf "\n"
EDIT 2:
replacing |-
with |
doesn't change anything. The process still doesn't terminate.
Removing the last EOF
has the same effect
I could make it work by calling exit 0
manually:
after-script:
- |-
ssh -tt -p 222 user@example.com "/bin/bash" << EOF
cd public_html/staging && npm i && pm2 delete my-app || : && VITE_BASE_URL=$VITE_BASE_URL pm2 -f start build/index.js --update-env --name my-app
- exit 0