Skip to content

Commit a6d49f3

Browse files
authored
Merge pull request #598 from matkoch/master
Add SpaceAutomation
2 parents 163380e + 50c7175 commit a6d49f3

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/NerdBank.GitVersioning/CloudBuild.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public static class CloudBuild
2121
new Jenkins(),
2222
new GitLab(),
2323
new Travis(),
24+
new SpaceAutomation(),
2425
};
2526

2627
/// <summary>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
5+
namespace Nerdbank.GitVersioning.CloudBuildServices
6+
{
7+
/// <summary>
8+
/// SpaceAutomation CI build support.
9+
/// </summary>
10+
/// <remarks>
11+
/// The SpaceAutomation-specific properties referenced here are documented here:
12+
/// https://www.jetbrains.com/help/space/automation-environment-variables.html
13+
/// </remarks>
14+
internal class SpaceAutomation : ICloudBuild
15+
{
16+
public string BuildingBranch => CloudBuild.IfStartsWith(BuildingRef, "refs/heads/");
17+
18+
public string BuildingTag => CloudBuild.IfStartsWith(BuildingRef, "refs/tags/");
19+
20+
public string GitCommitId => Environment.GetEnvironmentVariable("JB_SPACE_GIT_REVISION");
21+
22+
public bool IsApplicable => this.GitCommitId != null;
23+
24+
public bool IsPullRequest => false;
25+
26+
private static string BuildingRef => Environment.GetEnvironmentVariable("JB_SPACE_GIT_BRANCH");
27+
28+
public IReadOnlyDictionary<string, string> SetCloudBuildNumber(string buildNumber, TextWriter stdout, TextWriter stderr)
29+
{
30+
return new Dictionary<string, string>();
31+
}
32+
33+
public IReadOnlyDictionary<string, string> SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr)
34+
{
35+
return new Dictionary<string, string>();
36+
}
37+
}
38+
}

src/NerdBank.GitVersioning/CloudBuildServices/TeamCity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
/// TeamCity CI build support.
99
/// </summary>
1010
/// <remarks>
11-
/// The TeamCIty-specific properties referenced here are documented here:
12-
/// https://confluence.jetbrains.com/display/TCD8/Predefined+Build+Parameters
11+
/// The TeamCity-specific properties referenced here are documented here:
12+
/// https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
1313
/// </remarks>
1414
internal class TeamCity : ICloudBuild
1515
{

0 commit comments

Comments
 (0)