Skip to main content

Jenkins

Running on Jenkins will use the standard theming for your build log output.

info

Please refer to the official Jenkins documentation for questions not covered here.

Environment Variables​

You can access predefined environment variables by using the Jenkins class:

Jenkins Jenkins => Jenkins.Instance;

Target Print => _ => _
.Executes(() =>
{
Log.Information("Branch = {Branch}", Jenkins.GitBranch);
Log.Information("Commit = {Commit}", Jenkins.GitCommit);
});
Exhaustive list of strongly-typed properties
class Jenkins
{
string BranchName { get; }
string BuilDisplayName { get; }
int BuildNumber { get; }
string BuildTag { get; }
string ChangeId { get; }
int ExecutorNumber { get; }
string GitBranch { get; }
string GitCommit { get; }
string GitPreviousCommit { get; }
string GitPreviousSuccessfulCommit { get; }
string GitUrl { get; }
string JenkinsHome { get; }
string JenkinsServerCookie { get; }
string JobBaseName { get; }
string JobDisplayUrl { get; }
string JobName { get; }
string NodeLabels { get; }
string NodeName { get; }
string RunChangesDisplayUrl { get; }
string RunDisplayUrl { get; }
string Workspace { get; }
}