I run a self hosted Linux Shell BitBucket Runner and my pipeline's script is a bash script.
It has lots of phases but I'll show a part of it and I'll use short placeholders.
1. Build the project
2. ssh USER@SERVER "@cleanup"
3. scp OUTPUT_ZIP_FILE USER@SERVER:
4. ssh USER@SERVER "unzip ZIP_FILE ; cd FOLDER ; @Build ; zip OUTPUT_ZIP [.FOLDER...]*.*"
5. ssh USER@SERVER "copy [.FOLDER...]*.* [.NEW_FOLDER...]*.* ; @cleanup_foler, zip NEW_PACKAGE.zip [.NEW_FOLDER...]*.*"
The important thing I want is that these steps should run sequentially, the pipeline should wait for each command to finish and then execute the next command.
In the log of the pipeline I see quick dump of these steps and then Success, on remote machine I see CPU usage goes up and it continues doing its job for few minutes, even thought the pipeline is done already.
The bash script does what it should do when run on Linux machine, in a bash shell.
I tried to make each ssh->scp->ssh->ssh phase a step in bitbucket-pipeline.yml file. Step ran sequentially, but, again, each SSH command exits immediately without waiting for the command to finish.
What could be the problem of this "async" run of SSH commands?
Hi Tigran,
Allow me to step in, as I've noticed that you have not received a response from our community as of yet.
To troubleshoot this for you and determine if this is within our scope - we will need access to your Bitbucket Pipelines build environment, including your YAML configuration, build logs and build history.
To do so - we will need you to raise a support ticket using the paid workspace URL for your company workspace:
If you encounter issues raising a ticket - please let me know your timezone and I will raise one on your behalf with the support team that operates within your region.
Cheers!
- Ben (Bitbucket Cloud Support)
Hi Ben.
Thanks for reaching out.
Just near the time you wrote the answer I found solution to the problem.
And it is by prepending `script -c` to SSH and SCP commands.
--Tigran
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.