Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1278 - ContinuaCI use environment variable not registry. #1279

Merged
merged 2 commits into from
Aug 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}
}