in tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs [284:360]
private IEnumerable<string> CreatePushBuildConfiguration(string buildTypeId, string platform, IEnumerable<Image> allImages, params string[] buildBuildTypes)
{
var images = allImages.Where(i => i.File.Platform == platform).ToList();
yield return $"object {buildTypeId}: BuildType(" + "{";
yield return $"\t name = \"Push {platform}\"";
yield return $"\t{_buildNumberPattern}";
yield return "\t steps {";
foreach (var image in images)
{
// docker pull
var tag = image.File.Tags.First();
var repo = $"{image.File.ImageId}{BuildImagePostfix}:{tag}";
var repoTag = $"{BuildRepositoryName}{repo}";
foreach (var pullCommand in CreatePullCommand(repoTag, repo))
{
yield return $"\t\t{pullCommand}";
}
var newRepo = $"{DeployRepositoryName}{image.File.ImageId}";
var newRepoTag = $"{newRepo}:{image.File.Tags.First()}";
foreach (var tagCommand in CreateTagCommand(repoTag, newRepoTag, repo))
{
yield return $"\t\t{tagCommand}";
}
foreach (var pushCommand in CreatePushCommand($"{newRepo}", repo, tag))
{
yield return $"\t\t{pushCommand}";
}
}
yield return "\t }";
yield return "\t features {";
var weight = images.Sum(i => i.File.Weight.Value);
if (weight > 0)
{
foreach (var feature in CreateFreeDiskSpaceFeature(weight))
{
yield return $"\t\t {feature}";
}
}
foreach (var feature in CreateDockerFeature())
{
yield return $"\t\t {feature}";
}
// ReSharper disable once StringLiteralTypo
foreach (var feature in CreateSwabraFeature())
{
yield return $"\t\t {feature}";
}
yield return "\t }";
foreach (var param in CreateSpaceParams(weight))
{
yield return $"\t{param}";
}
var requirements = images.SelectMany(i => i.File.Requirements).Distinct().ToList();
foreach (var lines in CreateDockerRequirements(requirements, platform))
{
yield return $"\t {lines}";
}
foreach (var dependencies in CreateSnapshotDependencies(buildBuildTypes, null))
{
yield return $"\t{dependencies}";
}
yield return "})";
yield return string.Empty;
}