More experiments with flow id

This commit is contained in:
Pranav K 2016-04-01 06:38:08 -07:00
parent a8516ec538
commit cb70183b03
1 changed files with 58 additions and 59 deletions

View File

@ -155,11 +155,9 @@ var buildTarget = "compile"
{ {
Parallel.ForEach(batch.ToArray(), new ParallelOptions { MaxDegreeOfParallelism = threads }, repo => Parallel.ForEach(batch.ToArray(), new ParallelOptions { MaxDegreeOfParallelism = threads }, repo =>
{ {
var blockName = string.Format("Building {0}", repo); if (IsTeamCity)
if (blockLogger != null)
{ {
blockLogger.StartBlock(blockName); Console.WriteLine(string.Format("##teamcity[blockOpened name='{0}' flowId='KOREBUILD_{0}']", repo));
} }
if (!IsLinux) if (!IsLinux)
@ -174,45 +172,46 @@ var buildTarget = "compile"
try try
{ {
Exec(CreateBuildWithFlowId(repo), buildTarget, repo); Exec(CreateBuildWithFlowId(repo), buildTarget, repo);
var repoArtifacts = Path.Combine(repo, "artifacts");
var repoBuild = Path.Combine(repoArtifacts, "build");
if (Directory.Exists(repoBuild))
{
foreach (var source in Directory.EnumerateFiles(repoBuild, "*.nupkg"))
{
File.Copy(source, Path.Combine(universeBuild, Path.GetFileName(source)), overwrite: true);
}
if (Environment.GetEnvironmentVariable("KOREBUILD_ADD_ASSEMBLY_INFO") == "1")
{
var commitFile = Path.Combine(repoArtifacts, "commit");
if (!File.Exists(commitFile))
{
throw new FileNotFoundException("Couldn't find the commit file for " + repo + ": " + commitFile);
}
commits.TryAdd(repo, File.ReadAllLines(commitFile)[0]);
}
if (!string.IsNullOrEmpty(ciVolatileShare))
{
Log.Info("Publishing packages to " + ciVolatileShare);
NuGetPackagesAdd(repoBuild, ciVolatileShare);
}
}
Log.Info(string.Format("Build {0} succeeded", repo));
} }
catch (Exception ex) catch (Exception ex)
{ {
Log.Error("Building '" + repo + "' failed: " + ex); Log.Error("Building '" + repo + "' failed: " + ex);
throw; throw;
} }
finally
var repoArtifacts = Path.Combine(repo, "artifacts");
var repoBuild = Path.Combine(repoArtifacts, "build");
if (Directory.Exists(repoBuild))
{ {
foreach (var source in Directory.EnumerateFiles(repoBuild, "*.nupkg")) if (IsTeamCity)
{ {
File.Copy(source, Path.Combine(universeBuild, Path.GetFileName(source)), overwrite: true); Console.WriteLine(string.Format("##teamcity[blockClosed name='{0}' flowId='KOREBUILD_{0}']", repo));
} }
if (Environment.GetEnvironmentVariable("KOREBUILD_ADD_ASSEMBLY_INFO") == "1")
{
var commitFile = Path.Combine(repoArtifacts, "commit");
if (!File.Exists(commitFile))
{
throw new FileNotFoundException("Couldn't find the commit file for " + repo + ": " + commitFile);
}
commits.TryAdd(repo, File.ReadAllLines(commitFile)[0]);
}
if (!string.IsNullOrEmpty(ciVolatileShare))
{
Log.Info("Publishing packages to " + ciVolatileShare);
NuGetPackagesAdd(repoBuild, ciVolatileShare);
}
}
Log.Info(string.Format("Build {0} succeeded", repo));
if (blockLogger != null)
{
blockLogger.EndBlock(blockName);
} }
}); });
} }