Allow a 'Gate branch' which is built instead of dev if it exists
This commit is contained in:
parent
cb70183b03
commit
af46fec11f
|
|
@ -45,6 +45,9 @@ functions
|
||||||
static string repositoryInclude = GetEnvironmentParameter("KOREBUILD_REPOSITORY_INCLUDE");
|
static string repositoryInclude = GetEnvironmentParameter("KOREBUILD_REPOSITORY_INCLUDE");
|
||||||
static string repositoryExclude = GetEnvironmentParameter("KOREBUILD_REPOSITORY_EXCLUDE");
|
static string repositoryExclude = GetEnvironmentParameter("KOREBUILD_REPOSITORY_EXCLUDE");
|
||||||
|
|
||||||
|
static string gateBranch = GetEnvironmentParameter("KOREBUILD_GATE_BRANCH");
|
||||||
|
private static bool UseGateBranch = !string.IsNullOrEmpty(gateBranch);
|
||||||
|
|
||||||
// Doesn't build on Mono since their contracts don't match
|
// Doesn't build on Mono since their contracts don't match
|
||||||
string[] repositories = GetRepositoriesToBuild().ToArray();
|
string[] repositories = GetRepositoriesToBuild().ToArray();
|
||||||
string[] noSrcRepositoryExclude = GetNoSrcDeleteRepositories().ToArray();
|
string[] noSrcRepositoryExclude = GetNoSrcDeleteRepositories().ToArray();
|
||||||
|
|
@ -126,14 +129,57 @@ var buildTarget = "compile"
|
||||||
|
|
||||||
Parallel.ForEach(repositories, repo =>
|
Parallel.ForEach(repositories, repo =>
|
||||||
{
|
{
|
||||||
|
var useBuildBranch = true;
|
||||||
if (Directory.Exists(repo))
|
if (Directory.Exists(repo))
|
||||||
|
{
|
||||||
|
if (UseGateBranch)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GitCommand("", string.Format("pull --ff-only --quiet --depth 1 git@github.com:aspnet/{1}.git {0}:{0}", gateBranch, repo));
|
||||||
|
useBuildBranch = false;
|
||||||
|
Log.Warn(string.Format(
|
||||||
|
"{0} has a branch '{1}' which is overriding use of {2}. {1} must be deleted before {2} will be used.",
|
||||||
|
repo,
|
||||||
|
gateBranch,
|
||||||
|
buildBranch));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Info(string.Format("{0} doesn't exist, falling back to {1}.", gateBranch, buildBranch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useBuildBranch)
|
||||||
{
|
{
|
||||||
GitCommand("", string.Format("pull --ff-only --quiet --depth 1 git@github.com:aspnet/{1}.git {0}:{0}", buildBranch, repo));
|
GitCommand("", string.Format("pull --ff-only --quiet --depth 1 git@github.com:aspnet/{1}.git {0}:{0}", buildBranch, repo));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (UseGateBranch)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GitCommand("", string.Format("clone --quiet --depth 1 --branch {0} git@github.com:aspnet/{1}.git", gateBranch, repo));
|
||||||
|
useBuildBranch = false;
|
||||||
|
Log.Warn(string.Format(
|
||||||
|
"{0} has a branch '{1}' which is overriding use of {2}. {1} must be deleted before {2} will be used.",
|
||||||
|
repo,
|
||||||
|
gateBranch,
|
||||||
|
buildBranch));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Info(string.Format("{0} doesn't exist, falling back to {1}.", gateBranch, buildBranch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useBuildBranch)
|
||||||
{
|
{
|
||||||
GitCommand("", string.Format("clone --quiet --depth 1 --branch {0} git@github.com:aspnet/{1}.git", buildBranch, repo));
|
GitCommand("", string.Format("clone --quiet --depth 1 --branch {0} git@github.com:aspnet/{1}.git", buildBranch, repo));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (blockLogger != null)
|
if (blockLogger != null)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue