Skip to content

Commit 50c7175

Browse files
committed
Add SpaceAutomation support
1 parent 6faef50 commit 50c7175

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
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+
}

0 commit comments

Comments
 (0)