-
Notifications
You must be signed in to change notification settings - Fork 651
/
Copy pathTeamCity.cs
43 lines (36 loc) · 1.58 KB
/
TeamCity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace GitVersion
{
using System;
public class TeamCity : BuildServerBase
{
Authentication authentication;
public TeamCity(Authentication authentication)
{
this.authentication = authentication;
}
public override bool CanApplyToCurrentContext()
{
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION"));
}
public override void PerformPreProcessingSteps(string gitDirectory)
{
if (string.IsNullOrEmpty(gitDirectory))
{
throw new WarningException("Failed to find .git directory on agent. Please make sure agent checkout mode is enabled for you VCS roots - http://confluence.jetbrains.com/display/TCD8/VCS+Checkout+Mode");
}
GitHelper.NormalizeGitDirectory(gitDirectory, authentication);
}
public override string[] GenerateSetParameterMessage(string name, string value)
{
return new[]
{
string.Format("##teamcity[setParameter name='GitVersion.{0}' value='{1}']", name, ServiceMessageEscapeHelper.EscapeValue(value)),
string.Format("##teamcity[setParameter name='system.GitVersion.{0}' value='{1}']", name, ServiceMessageEscapeHelper.EscapeValue(value))
};
}
public override string GenerateSetVersionMessage(string versionToUseForBuildNumber)
{
return string.Format("##teamcity[buildNumber '{0}']", ServiceMessageEscapeHelper.EscapeValue(versionToUseForBuildNumber));
}
}
}