Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Supports:
* [MyGet](https://docs.myget.org/docs/reference/build-services#Available_Environment_Variables)
* [GitLab](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)
* [GoCD](https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html)
* [Bitbucket Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Default-variables)

There are also individual properties to check for each specific build system

Expand All @@ -161,8 +162,9 @@ var isMyGet = BuildServerDetector.IsMyGet;
var isGoDc = BuildServerDetector.IsGoDc;
var isDocker = BuildServerDetector.IsDocker;
var isAppVeyor = BuildServerDetector.IsAppVeyor;
var isBitbucketPipelines = BuildServerDetector.IsBitbucketPipelines;
```
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L8-L22' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorProps' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L8-L23' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorProps' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -206,7 +208,7 @@ public async Task SetDetectedDoesNotLeakToOtherContexts()
await Assert.That(BuildServerDetector.Detected).IsEqualTo(parentValue);
}
```
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L27-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorDetectedOverride' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/DiffEngine.Tests/BuildServerDetectorTest.cs#L28-L63' title='Snippet source file'>snippet source</a> | <a href='#snippet-BuildServerDetectorDetectedOverride' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
1 change: 1 addition & 0 deletions readme.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Supports:
* [MyGet](https://docs.myget.org/docs/reference/build-services#Available_Environment_Variables)
* [GitLab](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)
* [GoCD](https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html)
* [Bitbucket Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Default-variables)

There are also individual properties to check for each specific build system

Expand Down
1 change: 1 addition & 0 deletions src/DiffEngine.Tests/BuildServerDetectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void Props()
var isGoDc = BuildServerDetector.IsGoDc;
var isDocker = BuildServerDetector.IsDocker;
var isAppVeyor = BuildServerDetector.IsAppVeyor;
var isBitbucketPipelines = BuildServerDetector.IsBitbucketPipelines;

#endregion

Expand Down
9 changes: 8 additions & 1 deletion src/DiffEngine/BuildServerDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ static BuildServerDetector()
// https://www.appveyor.com/docs/environment-variables/
IsAppVeyor = variables.Contains("APPVEYOR");

// Bitbucket Pipelines
// https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Default-variables
IsBitbucketPipelines = variables.Contains("BITBUCKET_BUILD_NUMBER");

IsWsl = variables.Contains("WSL_DISTRO_NAME");

// AzureDevops
Expand All @@ -62,7 +66,8 @@ static BuildServerDetector()
IsGoDc ||
IsDocker ||
IsWsl ||
IsAppVeyor;
IsAppVeyor ||
IsBitbucketPipelines;
}

static bool detected;
Expand All @@ -83,6 +88,8 @@ static bool ValueEquals(IDictionary variables, string key, string value)

public static bool IsAppVeyor { get; }

public static bool IsBitbucketPipelines { get; }

public static bool IsTravis { get; }

public static bool IsDocker { get; }
Expand Down
Loading