Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ssh command runs successfully but the pipeline does not end

I'm finalizing my pipeline on bitbucket and I'm having a problem initializing my war package.

I am starting my application through the "su root ./pacote.war" command via .sh script.

It starts successfully but the pipeline command does not understand that it has already finished the script and does not exit the deploy activity.

Do you have any tips to indicate that deploy has finished or some other command / parameter to use to initialize the application?

1 answer

0 votes

Hi Geann,

Can you try add some logging for process information into your build?

  default: # Or whatever you trigger your build off, such as branches/tags/pull-requests
    - step:
          - process-logs.txt # Declaring that you want to keep this as an artifact
          - while true; do date && ps aux && echo "" && sleep 30; done >> process-logs.txt &
          - # The rest of your script.

I suspect you have a process hanging, which Pipelines is waiting to complete. Can you verify that none of your commands need to be manually terminated, such as your application war.



Hi @Philip Hodder , this is my pipeline log.

This is the question, pipeline is waiting to complete but the application already is up but i don't know how to pass this information to pipeline. So in this case i have to stop manually.

+ umask 000

+ GIT_LFS_SKIP_SMUDGE=1 git clone -n https://x-token-auth:$$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...

+ git checkout 30f8312a402619cc1f3c84f5e1036cecffc5dc09
Note: checking out '30f8312a402619cc1f3c84f5e1036cecffc5dc09'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

HEAD is now at 30f8312a... bitbucket-pipelines.yml edited online with Bitbucket

+ git config bitbucket-pipelines

+ git config

+ git config push.default current

+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

+ git remote set-url origin$BITBUCKET_REPO_FULL_NAME

+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude

+ chmod 777 $BUILD_DIR

+ docker container run \
--volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \
--volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \
--volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \
--volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run \
--workdir=$(pwd) \
--label=org.bitbucket.pipelines.system=true \
--env=CI="$CI" \
--env=DOCKER_HOST="tcp://host.docker.internal:2375" \
--env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \
--env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/ssh-run" \
--env=COMMAND="/opt/onticket-dev/" \
--env=MODE="command" \
--env=SERVER="$FTP_HOST" \
--env=SSH_USER="$FTP_USER" \
--add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \
Unable to find image 'bitbucketpipelines/ssh-run:0.2.0' locally
0.2.0: Pulling from bitbucketpipelines/ssh-run
e7c96db7181b: Pulling fs layer
9806e1cfafda: Pulling fs layer
b83ff933fec4: Pulling fs layer
394bcfb5fb04: Pulling fs layer
394bcfb5fb04: Waiting
b83ff933fec4: Verifying Checksum
b83ff933fec4: Download complete
e7c96db7181b: Verifying Checksum
e7c96db7181b: Download complete
9806e1cfafda: Verifying Checksum
9806e1cfafda: Download complete
394bcfb5fb04: Download complete
e7c96db7181b: Pull complete
9806e1cfafda: Pull complete
b83ff933fec4: Pull complete
394bcfb5fb04: Pull complete
Digest: sha256:31076f292c2fb25bbb101e618e6108b3c32b94473e17f97cd707373df72fab1e
Status: Downloaded newer image for bitbucketpipelines/ssh-run:0.2.0
[36mINFO: Executing the pipe... [0m
[36mINFO: Using default ssh key [0m
[36mINFO: Executing command on $FTP_HOST [0m
ssh -A -tt -i /$FTP_USER/.ssh/pipelines_id -o StrictHostKeyChecking=no -p 22 $FTP_USER@$FTP_HOST /
[94m:: JHipster > :: Running Spring Boot 1.5.9.RELEASE ::
Application is running! Access URLs:
Local: http://localhost:8080
Profile(s): [swagger, dev]

Cheers. As you mention, it looks like you're starting your application. Pipelines won't complete until the application finishes running, as it's waiting for the process to complete executing. Why do you need to start the web server in your SSH session? Could that be something you could remove and trigger the start up elsewhere, as then Pipelines won't hang waiting for the process to close. Otherwise you could also start it as a background process, rather than on the main thread of your SSH session.

Also, are there any cases where your pipeline isn't hanging, or is this a consistent issue?

Like Veronika Priesner likes this

About "Otherwise you could also start it as a background process, rather than on the main thread of your SSH session." How can i do it?

Like Veronika Priesner likes this

Also, I had the same problem and I tried to solved with '&' in the end of the command to run the process in the background and redirected the stdout and stderr using 1>>"logfile.log" 2>&1 .

"Otherwise you could also start it as a background process, rather than on the main thread of your SSH session." I'd also really like the answer to that.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

220 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you