Skip to content

Commit 443c994

Browse files
authored
Merge pull request #1279 from dazinator/issue-1278
Fixes #1278 - ContinuaCI use environment variable not registry.
2 parents 0c27156 + cf341bb commit 443c994

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed
+6-22
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
namespace GitVersion
22
{
3-
using Microsoft.Win32;
3+
using System;
44

55
public class ContinuaCi : BuildServerBase
66
{
7-
public override bool CanApplyToCurrentContext()
8-
{
9-
const string KeyName = @"Software\VSoft Technologies\Continua CI Agent";
107

11-
if (RegistryKeyExists(KeyName, RegistryView.Registry32))
12-
{
13-
return true;
14-
}
8+
public const string EnvironmentVariableName = "ContinuaCI.Version";
159

16-
if (RegistryKeyExists(KeyName, RegistryView.Registry64))
17-
{
18-
return true;
19-
}
10+
public override bool CanApplyToCurrentContext()
11+
{
12+
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
2013

21-
return false;
2214
}
2315

2416
public override string[] GenerateSetParameterMessage(string name, string value)
@@ -32,14 +24,6 @@ public override string[] GenerateSetParameterMessage(string name, string value)
3224
public override string GenerateSetVersionMessage(VersionVariables variables)
3325
{
3426
return string.Format("@@continua[setBuildVersion value='{0}']", variables.FullSemVer);
35-
}
36-
37-
static bool RegistryKeyExists(string keyName, RegistryView registryView)
38-
{
39-
var localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView);
40-
localKey = localKey.OpenSubKey(keyName);
41-
42-
return localKey != null;
43-
}
27+
}
4428
}
4529
}

0 commit comments

Comments
 (0)