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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,782
Community Members
 
Community Events
184
Community Groups

How do I stop my Pipeline from running after each commit with a selfhosted Runner?

Hello,

Is there a way to configure my Pipeline with a selfhosted-Runner to only manually run my Pipeline?

According to https://support.atlassian.com/bitbucket-cloud/docs/pipeline-triggers/ I have to define a custom Pipeline for this. But then my Pipeline displays this:

CustomnotonSelfhosted.PNG

My Test yaml code looks like this atm:

pipelines:
custom:
build-and-test:
- step:
runs-on:
- self.hosted
- windows
name: Build and Test
image: mcr.microsoft.com/dotnet/sdk:6.0
caches:
- dotnetcore
script:
- echo 'Checking if mssql container exists...'
- if (docker ps -a --format '{{.Names}}' -match '^mssql$') { echo 'Removing existing mssql container...'; docker rm -f mssql }
- echo 'Starting SQL Server Docker container...'
- docker run --name mssql -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=SecurePW123!" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest
- echo 'Wait for SQL Server to start...'
- sleep 30
- echo 'Running database setup script...'
- sqlcmd -S localhost -U sa -P "SecurePW123!" -Q "CREATE DATABASE TestDB;"
- |
sqlcmd -S localhost -U sa -P "SecurePW123!" -d TestDB -Q "
CREATE TABLE Customers (CustomerId INT PRIMARY KEY, FirstName VARCHAR(50), LastName VARCHAR(50));
INSERT INTO Customers (CustomerId, FirstName, LastName) VALUES (1, 'John', 'Doe'), (2, 'Jane', 'Doe');"
- dotnet restore netCo.Butler.UnittestDemo/UnittestDemo.sln
- dotnet build --no-restore netCo.Butler.UnittestDemo/UnittestDemo.sln
- dotnet test --no-build --verbosity normal netCo.Butler.UnittestDemo.Tests/netCo.Butler.UnittestDemo.Tests.csproj

If I change it back to "default" it works fine.

Is there any other way to only run the Pipeline manually(via API call) while using a selfhosted Runner?

 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2023

Hi Jonas,

The error is not referring to the use of a custom pipeline, but to the use of the image in the step:

image: mcr.microsoft.com/dotnet/sdk:6.0

Based on the runner label, I assume you are using a Windows Runner? Windows Runners do not use Docker and the builds do not run in Docker containers. They use PowerShell to run pipeline steps on your Windows machine (host device). The image definition makes sense only for Pipelines builds that run in our own infrastructure or in a Linux Docker Runner.

You need to remove the image definition and this error should not occur then.

Running a custom pipeline via API is also possible, as long as you remove the image definition:

Kind regards,
Theodora

Thank you very much Theodora!

That fixed my Problem😃

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 22, 2023

You are very welcome Jonas, I'm glad to have helped!

Please feel free to reach out if you ever need anything else!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events