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:
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?
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😃
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome Jonas, I'm glad to have helped!
Please feel free to reach out if you ever need anything else!
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.