Skip to content

Commit

Permalink
Merge pull request #1279 from dazinator/issue-1278
Browse files Browse the repository at this point in the history
Fixes #1278 - ContinuaCI use environment variable not registry.
  • Loading branch information
dazinator authored Aug 16, 2017
2 parents 0c27156 + cf341bb commit 443c994
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/GitVersionCore/BuildServers/ContinuaCi.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
namespace GitVersion
{
using Microsoft.Win32;
using System;

public class ContinuaCi : BuildServerBase
{
public override bool CanApplyToCurrentContext()
{
const string KeyName = @"Software\VSoft Technologies\Continua CI Agent";

if (RegistryKeyExists(KeyName, RegistryView.Registry32))
{
return true;
}
public const string EnvironmentVariableName = "ContinuaCI.Version";

if (RegistryKeyExists(KeyName, RegistryView.Registry64))
{
return true;
}
public override bool CanApplyToCurrentContext()
{
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));

return false;
}

public override string[] GenerateSetParameterMessage(string name, string value)
Expand All @@ -32,14 +24,6 @@ public override string[] GenerateSetParameterMessage(string name, string value)
public override string GenerateSetVersionMessage(VersionVariables variables)
{
return string.Format("@@continua[setBuildVersion value='{0}']", variables.FullSemVer);
}

static bool RegistryKeyExists(string keyName, RegistryView registryView)
{
var localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView);
localKey = localKey.OpenSubKey(keyName);

return localKey != null;
}
}
}
}

0 comments on commit 443c994

Please sign in to comment.