Create
cancel
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

Run only one pipeline at time

Hello, 

 

I use bitbucket pipelines for E2E testing on my remote server. Pipleline deploys code to test serverer and runs all tests. It works just fine. But when multiple pipeliens starts, collision happends. I have only one test server and I cant create new one for each pipeline, so second pipeline replace code on server and first  pipeline usually fails. 

Is there any way to wait until previous pipeline is finished? Or any other workaround? thanks!

1 answer

0 votes

Hello Petr,

Reviewing your case my understanding is that you do not want more than one instance of your pipeline running concurrently because you have just one deployment environment.

In order to avoid that concurrency I would recommend you tracking your deployments by using the Bitbucket Deployments. This way whenever a pipeline step starts a new deployment to a given environment, Bitbucket will first check if there's any other deployment already running to that same environment.

If there's already a deployment in progress, the later pipeline deployment to the same environment will be paused. Once one of the concurrent pipelines complete, you can manually resume the paused one.

So in your case, I'd suggest setting up a deployment environment in your yml to the steps that are sensitive to concurrency by adding the deployment option :

- step:
    name: Deploy to test
    image: atlassian/default-image:3
    deployment: test
    script:
      - python deploy.py test

You can check and change your repository's deployment environments going to :

  • Repository settings.
  • In the Pipelines section, choose Deployments

There you will be allowed to change environment name, set environment variables and restrict the ability to deployments.

Also, you can refer to this documentation for more details about setting up deployment environments :

And to this one for  Deployment concurrency control  :

Please, let me know if this suggestion works for you :)

Kind regards,

Patrik S

Suggest an answer

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

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,523 views 4 8
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