Out of the box support
The Jenkins alias, which returns an IJenkinsProvider instance can be used to interact with the Jenkins environment.
The following example prints the build number if running on Jenkins:
if (BuildSystem.Jenkins.IsRunningOnJenkins)
{
Information(BuildSystem.Jenkins.Environment.Build.BuildNumber);
}
else
{
Information("Not running on Jenkins");
}
See IJenkinsProvider for details and available methods to interact with Jenkins.
Running Cake
The recommended way to run the Cake .NET Tool on Jenkins is by using a tool manifest. In your Jenkinsfile or as a build step, use:
dotnet tool restore
dotnet cake
If you are using Cake.Sdk with a file-based script:
dotnet cake.cs
If you are using Cake.Sdk with a project:
dotnet run --project cake.csproj
If you are using Cake Frosting:
dotnet run --project cake.csproj
Available 3rd party extensions
No extensions found
