Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to write multiple steps or parallels in bitbucket-pipelines.yml file for a self-hosted runner

Ashish Srivastava November 2, 2021

I have created a self-hosted runner to run the bitbucket pipeline. There I want to run multiple steps or parallel on the same runner.

But only the step which has 'runs-on' tag with the label 'self.hosted' is running on the runner, other steps are running on Atlassian's infrastructure.

I don't want to add a repetitive 'runs-on' tag for each step.

Below is my current bitbucket-pipeline.yml file structure:

pipelines:
default:
- step:
runs-on:
- 'self.hosted'
- step:
name: Upload app
script:
- chmod +x appUpload.sh
- ./appUpload.sh
- parallel:
- step:
name: Build and Test
caches:
- maven
script:
- mvn clean
- mvn -B verify --file pom.xml test
after-script:
- pipe: atlassian/checkstyle-report:0.2.0
- step:
name: Security Scan
script:
- pipe: atlassian/git-secrets-scan:0.4.3

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 3, 2021

Hi @Ashish Srivastava,

Steps that will run on a runner must have the runs-on parameter and this parameter must contain a self.hosted label. It is not possible at the moment to specify that all steps will run on a runner, without adding this parameter for every step.

A runner can run one step at a time. It allocates the resources you provided to run your build, so when you have multiple steps or parallel steps it is queued up because the resources are currently used by one of the other steps.

If you wish to run parallel steps together you'll have to create a runner for every single step and make use of labels to label the runner according to your steps. It is possible to host multiple runners on a single host as long as the host has the necessary resources to run all the builds otherwise the build will fail.

We have a feature request in our issue tracker for the ability to specify that all steps will run on a certain runner without repeating the runs-on parameter for every step:

And additionally for the ability to run parallel steps on a single runner:

If you'd be interested in these features, I would suggest adding your vote in the features requests (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature requests.

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events