diff --git a/.teamcity/generated/HubProject.kts b/.teamcity/generated/HubProject.kts index 8c9b26d5b..556416a8a 100644 --- a/.teamcity/generated/HubProject.kts +++ b/.teamcity/generated/HubProject.kts @@ -1,18 +1,31 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object HubProject : Project({ -name = "Docker hub" -buildType(PushHubLinux.push_hub_linux) -buildType(PushHubWindows.push_hub_windows) -buildType(PublishHubVersion.publish_hub_version) + name = "Docker hub" + buildType(PushHubLinux.push_hub_linux) + buildType(PushHubWindows.push_hub_windows) + buildType(PublishHubVersion.publish_hub_version) }) diff --git a/.teamcity/generated/ImageValidation.kts b/.teamcity/generated/ImageValidation.kts index a89428ff3..2ab21a5f0 100644 --- a/.teamcity/generated/ImageValidation.kts +++ b/.teamcity/generated/ImageValidation.kts @@ -1,136 +1,104 @@ // NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... -// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... // ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated -import common.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* +import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +object image_validation: BuildType({ + name = "Validation of Size Regression - Staging Docker Images (Windows / Linux)" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + vcs { + root(TeamCityDockerImagesRepo) + } + + triggers { + // Execute the build once the images are available within %deployRepository% + finishBuildTrigger { + buildType = "${PublishHubVersion.publish_hub_version.id}" + } + } + + params { + // -- inherited parameter, removed in debug purposes + param("dockerImage.teamcity.buildNumber", "-") + } + + val targetImages: HashMap = hashMapOf( +"teamcity-server-EAP-linux" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux", + "teamcity-agent-EAP-linux-arm64-sudo" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo", + "teamcity-agent-EAP-linux-arm64" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64", + "teamcity-agent-EAP-linux" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux", + "teamcity-agent-EAP-linux-sudo" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo", + "teamcity-minimal-agent-EAP-linux" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux", + "teamcity-server-EAP-nanoserver-1809" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809", + "teamcity-agent-EAP-windowsservercore-1809" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809", + "teamcity-agent-EAP-nanoserver-1809" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809", + "teamcity-minimal-agent-EAP-nanoserver-1809" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809", + "teamcity-server-EAP-nanoserver-2004" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004", + "teamcity-agent-EAP-windowsservercore-2004" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004", + "teamcity-agent-EAP-nanoserver-2004" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004", + "teamcity-minimal-agent-EAP-nanoserver-2004" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + ) + + steps { + targetImages.forEach { (imageVerificationStepId, imageDomainName) -> + // Generate validation for each image fully-qualified domain name (FQDN) + gradle { + name = "Image Verification - $imageVerificationStepId" + tasks = "clean build run --args=\"validate $imageDomainName %docker.stagingRepository.login% %docker.stagingRepository.token%\"" + workingDir = "tool/automation/framework" + buildFile = "build.gradle" + jdkHome = "%env.JDK_11_x64%" + executionMode = BuildStep.ExecutionMode.ALWAYS + } + } + } + + failureConditions { + // Failed in case the validation via framework didn't succeed + failOnText { + conditionType = BuildFailureOnText.ConditionType.CONTAINS + pattern = "DockerImageValidationException" + failureMessage = "Docker Image validation have failed" + // allows the steps to continue running even in case of one problem + reportOnlyFirstMatch = false + } + } + + requirements { + exists("env.JDK_11") + // Images are validated mostly via DockerHub REST API. In case ... + // ... Docker agent will be used, platform-compatibility must be addressed, ... + // ... especially in case of Windows images. + contains("teamcity.agent.jvm.os.name", "Linux") + } + + features { + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + } +}) - -object image_validation: BuildType( - { - - - name = "Validation (post-push) of Docker images (Windows)" - buildNumberPattern="test-%build.counter%" - - vcs {root(TeamCityDockerImagesRepo.TeamCityDockerImagesRepo)} - - params { - // -- inherited parameter, removed in debug purposes - param("dockerImage.teamcity.buildNumber", "-") - } - - val images = listOf("%docker.deployRepository%teamcity-agent:2022.10-windowsservercore-1809", - "%docker.deployRepository%teamcity-agent:2022.10-nanoserver-1809", - "%docker.deployRepository%teamcity-minimal-agent:2022.10-nanoserver-1809", - "%docker.deployRepository%teamcity-server:2022.10-nanoserver-2004", - "%docker.deployRepository%teamcity-agent:2022.10-windowsservercore-2004", - "%docker.deployRepository%teamcity-agent:2022.10-nanoserver-2004", - "%docker.deployRepository%teamcity-minimal-agent:2022.10-nanoserver-2004" - // below are linux images -// "%docker.deployRepository%teamcity-agent:2022.10-linux", -// "%docker.deployRepository%teamcity-agent:2022.10-linux-sudo", -// "%docker.deployRepository%teamcity-minimal-agent:2022.10-linux", -// "%docker.deployRepository%teamcity-server:2022.10-nanoserver-1809", - ) - - steps { - images.forEach { - kotlinFile { - name = "Image Verification - $it" - - path = "tool/automation/ImageValidation.main.kts" - arguments = "$it" - executionMode = BuildStep.ExecutionMode.ALWAYS - - } - } - } - - - failureConditions { - -// failOnMetricChange { -// // -- target metric -//// param("metricKey", it.replace("%docker.deployRepository%", "").replace("2022.10-", "")) -// param("metricKey", "SIZE-teamcity-agent:windowsservercore-1809") -// -// units = BuildFailureOnMetric.MetricUnit.PERCENTS -// // -- 5% increase -// threshold = 5 -// comparison = BuildFailureOnMetric.MetricComparison.MORE -// compareTo = build { -// buildRule = lastSuccessful() -// } -// } - // fail in case statistics for any image changes for more than N percent - images.forEach { - failOnMetricChange { - // -- target metric -// param("metricKey", it.replace("%docker.deployRepository%", "").replace("2022.10-", "")) - param("metricKey", it.replace("%docker.deployRepository%", "").replace("2022.10-", "")) - - units = BuildFailureOnMetric.MetricUnit.PERCENTS - // -- 5% increase - threshold = 5 - comparison = BuildFailureOnMetric.MetricComparison.MORE - compareTo = build { - buildRule = lastSuccessful() - } - } - } - - - failOnText { - conditionType = BuildFailureOnText.ConditionType.CONTAINS - pattern = "DockerImageValidationException" - failureMessage = "Docker Image validation have failed" - // allows the steps to continue running even in case of one problem - reportOnlyFirstMatch = false - } - } - triggers { - finishBuildTrigger { - buildType = "${PublishHubVersion.publish_hub_version.id}" - } - } - - requirements { - // -- compatibility with Windows images - contains("teamcity.agent.jvm.os.name", "Windows") - } - - features { - dockerSupport { - cleanupPushedImages = true - loginToRegistry = on { - dockerRegistryId = "PROJECT_EXT_774,PROJECT_EXT_315" - } - } - } -// dependencies { -// dependency(AbsoluteId("TC_Trunk_DockerImages_push_hub_windows")) { -// snapshot { onDependencyFailure = FailureAction.ADD_PROBLEM } -// } -// dependency(AbsoluteId("TC_Trunk_DockerImages_push_hub_linux")) { -// snapshot { onDependencyFailure = FailureAction.ADD_PROBLEM } -// } - - // -- build number dependency -// dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { -// snapshot { -// reuseBuilds = ReuseBuilds.ANY -// onDependencyFailure = FailureAction.IGNORE -// } -// } -// } - }) diff --git a/.teamcity/generated/LocalProject.kts b/.teamcity/generated/LocalProject.kts index e4dd8fc27..39f3c4527 100644 --- a/.teamcity/generated/LocalProject.kts +++ b/.teamcity/generated/LocalProject.kts @@ -1,24 +1,37 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object LocalProject : Project({ -name = "Staging registry" -buildType(PushLocalLinux1804.push_local_linux_18_04) -buildType(PushLocalLinux2004.push_local_linux_20_04) -buildType(PushLocalWindows1803.push_local_windows_1803) -buildType(PushLocalWindows1809.push_local_windows_1809) -buildType(PushLocalWindows1903.push_local_windows_1903) -buildType(PushLocalWindows1909.push_local_windows_1909) -buildType(PushLocalWindows2004.push_local_windows_2004) -buildType(PublishLocal.publish_local) -buildType(ImageValidation.image_validation) + name = "Staging registry" + buildType(PushLocalLinux1804.push_local_linux_18_04) + buildType(PushLocalLinux2004.push_local_linux_20_04) + buildType(PushLocalWindows1803.push_local_windows_1803) + buildType(PushLocalWindows1809.push_local_windows_1809) + buildType(PushLocalWindows1903.push_local_windows_1903) + buildType(PushLocalWindows1909.push_local_windows_1909) + buildType(PushLocalWindows2004.push_local_windows_2004) + buildType(PublishLocal.publish_local) + buildType(ImageValidation.image_validation) }) diff --git a/.teamcity/generated/PublishHubVersion.kts b/.teamcity/generated/PublishHubVersion.kts index 31b139632..98fa8453a 100644 --- a/.teamcity/generated/PublishHubVersion.kts +++ b/.teamcity/generated/PublishHubVersion.kts @@ -1,139 +1,152 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +object publish_hub_version: BuildType({ + name = "Publish as version" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + enablePersonalBuilds = false + type = BuildTypeSettings.Type.DEPLOYMENT + maxRunningBuilds = 1 + steps { + script { + name = "remove manifests" + scriptContent = """if exist "%%USERPROFILE%%\.docker\manifests\" rmdir "%%USERPROFILE%%\.docker\manifests\" /s /q""" + } + dockerCommand { + name = "manifest create teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.deployRepository%teamcity-server:EAP %docker.deployRepository%teamcity-server:EAP-linux %docker.deployRepository%teamcity-server:EAP-nanoserver-1809 %docker.deployRepository%teamcity-server:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.deployRepository%teamcity-server:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.deployRepository%teamcity-server:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.deployRepository%teamcity-agent:EAP %docker.deployRepository%teamcity-agent:EAP-linux-arm64 %docker.deployRepository%teamcity-agent:EAP-linux %docker.deployRepository%teamcity-agent:EAP-nanoserver-1809 %docker.deployRepository%teamcity-agent:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.deployRepository%teamcity-agent:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.deployRepository%teamcity-agent:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.deployRepository%teamcity-minimal-agent:EAP %docker.deployRepository%teamcity-minimal-agent:EAP-linux %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.deployRepository%teamcity-minimal-agent:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.deployRepository%teamcity-minimal-agent:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.deployRepository%teamcity-agent:EAP-windowsservercore %docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004" + } + } + dockerCommand { + name = "manifest push teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.deployRepository%teamcity-agent:EAP-windowsservercore" + } + } + dockerCommand { + name = "manifest inspect teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.deployRepository%teamcity-agent:EAP-windowsservercore --verbose" + } + } + } + dependencies { + snapshot(AbsoluteId("TC_Trunk_BuildDistDocker")) { + + reuseBuilds = ReuseBuilds.ANY + onDependencyFailure = FailureAction.IGNORE + } + snapshot(PushHubLinux.push_hub_linux) { + + onDependencyFailure = FailureAction.FAIL_TO_START + } + snapshot(PushHubWindows.push_hub_windows) { -object publish_hub_version: BuildType( -{ -name = "Publish as version" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -enablePersonalBuilds = false -type = BuildTypeSettings.Type.DEPLOYMENT -maxRunningBuilds = 1 -steps { -script { -name = "remove manifests" -scriptContent = """if exist "%%USERPROFILE%%\.docker\manifests\" rmdir "%%USERPROFILE%%\.docker\manifests\" /s /q""" -} -dockerCommand { -name = "manifest create teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.deployRepository%teamcity-server:EAP %docker.deployRepository%teamcity-server:EAP-linux %docker.deployRepository%teamcity-server:EAP-nanoserver-1809 %docker.deployRepository%teamcity-server:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.deployRepository%teamcity-server:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.deployRepository%teamcity-server:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.deployRepository%teamcity-agent:EAP %docker.deployRepository%teamcity-agent:EAP-linux-arm64 %docker.deployRepository%teamcity-agent:EAP-linux %docker.deployRepository%teamcity-agent:EAP-nanoserver-1809 %docker.deployRepository%teamcity-agent:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.deployRepository%teamcity-agent:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.deployRepository%teamcity-agent:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.deployRepository%teamcity-minimal-agent:EAP %docker.deployRepository%teamcity-minimal-agent:EAP-linux %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.deployRepository%teamcity-minimal-agent:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.deployRepository%teamcity-minimal-agent:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.deployRepository%teamcity-agent:EAP-windowsservercore %docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004" -} -} -dockerCommand { -name = "manifest push teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.deployRepository%teamcity-agent:EAP-windowsservercore" -} -} -dockerCommand { -name = "manifest inspect teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.deployRepository%teamcity-agent:EAP-windowsservercore --verbose" -} -} -} -dependencies { -snapshot(AbsoluteId("TC_Trunk_BuildDistDocker")) -{ -reuseBuilds = ReuseBuilds.ANY -onDependencyFailure = FailureAction.IGNORE -} -snapshot(PushHubLinux.push_hub_linux) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -snapshot(PushHubWindows.push_hub_windows) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -} -requirements { -noLessThanVer("docker.version", "18.05.0") -contains("docker.server.osType", "windows") -contains("teamcity.agent.jvm.os.name", "Windows 10") -} -features { -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -} + onDependencyFailure = FailureAction.FAIL_TO_START + } + } + requirements { + noLessThanVer("docker.version", "18.05.0") + contains("docker.server.osType", "windows") + contains("system.agent.name", "docker") + contains("system.agent.name", "windows10") + } + features { + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + } }) diff --git a/.teamcity/generated/PublishLocal.kts b/.teamcity/generated/PublishLocal.kts index d5e80a930..8ec5cde3b 100644 --- a/.teamcity/generated/PublishLocal.kts +++ b/.teamcity/generated/PublishLocal.kts @@ -1,144 +1,157 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +object publish_local: BuildType({ + name = "Publish" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + enablePersonalBuilds = false + type = BuildTypeSettings.Type.DEPLOYMENT + maxRunningBuilds = 1 + steps { + script { + name = "remove manifests" + scriptContent = """if exist "%%USERPROFILE%%\.docker\manifests\" rmdir "%%USERPROFILE%%\.docker\manifests\" /s /q""" + } + dockerCommand { + name = "manifest create teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-server:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + dockerCommand { + name = "manifest push teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP" + } + } + dockerCommand { + name = "manifest inspect teamcity-minimal-agent:EAP" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP --verbose" + } + } + dockerCommand { + name = "manifest create teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "create %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + } + } + dockerCommand { + name = "manifest push teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "push %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore" + } + } + dockerCommand { + name = "manifest inspect teamcity-agent:EAP-windowsservercore" + commandType = other { + subCommand = "manifest" + commandArgs = "inspect %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore --verbose" + } + } + } + dependencies { + snapshot(AbsoluteId("TC_Trunk_BuildDistDocker")) { + + onDependencyFailure = FailureAction.FAIL_TO_START + reuseBuilds = ReuseBuilds.ANY + synchronizeRevisions = false + } + snapshot(PushLocalLinux2004.push_local_linux_20_04) { + + onDependencyFailure = FailureAction.FAIL_TO_START + } + snapshot(PushLocalWindows1809.push_local_windows_1809) { + + onDependencyFailure = FailureAction.FAIL_TO_START + } + snapshot(PushLocalWindows2004.push_local_windows_2004) { -object publish_local: BuildType( -{ -name = "Publish" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -enablePersonalBuilds = false -type = BuildTypeSettings.Type.DEPLOYMENT -maxRunningBuilds = 1 -steps { -script { -name = "remove manifests" -scriptContent = """if exist "%%USERPROFILE%%\.docker\manifests\" rmdir "%%USERPROFILE%%\.docker\manifests\" /s /q""" -} -dockerCommand { -name = "manifest create teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-server:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} -dockerCommand { -name = "manifest push teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP" -} -} -dockerCommand { -name = "manifest inspect teamcity-minimal-agent:EAP" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP --verbose" -} -} -dockerCommand { -name = "manifest create teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "create %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -} -} -dockerCommand { -name = "manifest push teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "push %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore" -} -} -dockerCommand { -name = "manifest inspect teamcity-agent:EAP-windowsservercore" -commandType = other { -subCommand = "manifest" -commandArgs = "inspect %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore --verbose" -} -} -} -dependencies { -snapshot(AbsoluteId("TC_Trunk_BuildDistDocker")) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -reuseBuilds = ReuseBuilds.ANY -synchronizeRevisions = false -} -snapshot(PushLocalLinux2004.push_local_linux_20_04) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -snapshot(PushLocalWindows1809.push_local_windows_1809) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -snapshot(PushLocalWindows2004.push_local_windows_2004) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -} -requirements { -noLessThanVer("docker.version", "18.05.0") -contains("docker.server.osType", "windows") -contains("teamcity.agent.jvm.os.name", "Windows 10") -} -features { -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -} + onDependencyFailure = FailureAction.FAIL_TO_START + } + } + requirements { + noLessThanVer("docker.version", "18.05.0") + contains("docker.server.osType", "windows") + contains("system.agent.name", "docker") + contains("system.agent.name", "windows10") + } + features { + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + } }) diff --git a/.teamcity/generated/PushHubLinux.kts b/.teamcity/generated/PushHubLinux.kts index c23ce41cd..511523fe8 100644 --- a/.teamcity/generated/PushHubLinux.kts +++ b/.teamcity/generated/PushHubLinux.kts @@ -1,203 +1,215 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo - -object push_hub_linux: BuildType( -{ -name = "Push linux" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -steps { -dockerCommand { -name = "pull teamcity-server%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-server%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-server:EAP-linux" -} -} - -dockerCommand { -name = "push teamcity-server%docker.buildImagePostfix%:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-server:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo %docker.deployRepository%teamcity-agent:EAP-linux-arm64-sudo" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-linux-arm64-sudo -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 %docker.deployRepository%teamcity-agent:EAP-linux-arm64" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-linux-arm64 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-agent:EAP-linux" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo %docker.deployRepository%teamcity-agent:EAP-linux-sudo" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-linux-sudo -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-minimal-agent:EAP-linux" -} -} - -dockerCommand { -name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-minimal-agent:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -} -features { -freeDiskSpace { -requiredSpace = "6gb" -failBuild = true -} -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -swabra { -forceCleanCheckout = true -} -} -params { -param("system.teamcity.agent.ensure.free.space", "6gb") -} -requirements { -contains("docker.server.osType", "linux") -} -dependencies { -snapshot(PublishLocal.publish_local) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -} +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +object push_hub_linux: BuildType({ + name = "Push linux" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + steps { + dockerCommand { + name = "pull teamcity-server%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-server%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-server:EAP-linux" + } + } + + dockerCommand { + name = "push teamcity-server%docker.buildImagePostfix%:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-server:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo %docker.deployRepository%teamcity-agent:EAP-linux-arm64-sudo" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-linux-arm64-sudo + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 %docker.deployRepository%teamcity-agent:EAP-linux-arm64" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-linux-arm64 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-agent:EAP-linux" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo %docker.deployRepository%teamcity-agent:EAP-linux-sudo" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-linux-sudo + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux %docker.deployRepository%teamcity-minimal-agent:EAP-linux" + } + } + + dockerCommand { + name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-minimal-agent:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + } + features { + freeDiskSpace { + requiredSpace = "6gb" + failBuild = true + } + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + swabra { + forceCleanCheckout = true + } + } + params { + param("system.teamcity.agent.ensure.free.space", "6gb") + } + requirements { + contains("docker.server.osType", "linux") + } + dependencies { + snapshot(PublishLocal.publish_local) { + + onDependencyFailure = FailureAction.FAIL_TO_START + } + } }) diff --git a/.teamcity/generated/PushHubWindows.kts b/.teamcity/generated/PushHubWindows.kts index 1f5a37f0a..94bc9a7c0 100644 --- a/.teamcity/generated/PushHubWindows.kts +++ b/.teamcity/generated/PushHubWindows.kts @@ -1,256 +1,268 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo - -object push_hub_windows: BuildType( -{ -name = "Push windows" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -steps { -dockerCommand { -name = "pull teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "tag teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-server:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "push teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-server:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-agent:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "tag teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-server:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "push teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-server:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-agent:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "push teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-agent:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "pull" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs -} -features { -freeDiskSpace { -requiredSpace = "52gb" -failBuild = true -} -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -swabra { -forceCleanCheckout = true -} -} -params { -param("system.teamcity.agent.ensure.free.space", "52gb") -} -requirements { -contains("docker.server.osType", "windows") -contains("teamcity.agent.jvm.os.name", "Windows 10") -} -dependencies { -snapshot(PublishLocal.publish_local) -{ -onDependencyFailure = FailureAction.FAIL_TO_START -} -} +object push_hub_windows: BuildType({ + name = "Push windows" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + steps { + dockerCommand { + name = "pull teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "tag teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-server:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "push teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-server:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-windowsservercore-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-agent:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "tag teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-server:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "push teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-server:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004 %docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-windowsservercore-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "tag teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-agent:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "push teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-agent:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "pull teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "pull" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "push teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.deployRepository%teamcity-minimal-agent:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + } + features { + freeDiskSpace { + requiredSpace = "52gb" + failBuild = true + } + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + swabra { + forceCleanCheckout = true + } + } + params { + param("system.teamcity.agent.ensure.free.space", "52gb") + } + requirements { + contains("docker.server.osType", "windows") + contains("system.agent.name", "docker") + contains("system.agent.name", "windows10") + } + dependencies { + snapshot(PublishLocal.publish_local) { + onDependencyFailure = FailureAction.FAIL_TO_START + } + } }) diff --git a/.teamcity/generated/PushLocalLinux1804.kts b/.teamcity/generated/PushLocalLinux1804.kts index 139e1af00..8b78f7838 100644 --- a/.teamcity/generated/PushLocalLinux1804.kts +++ b/.teamcity/generated/PushLocalLinux1804.kts @@ -1,18 +1,31 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_linux_18_04 : BuildType({ -name = "ON PAUSE Build and push linux 18.04" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-linux-arm64-18.04,EAP:EAP-linux-18.04,EAP teamcity-minimal-agent:EAP-linux-arm64-18.04,EAP:EAP-linux-18.04,EAP teamcity-agent:EAP-linux-arm64-18.04,EAP:EAP-linux-arm64-18.04-sudo:EAP-linux-18.04,EAP:EAP-linux-18.04-sudo" + name = "ON PAUSE Build and push linux 18.04" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-linux-arm64-18.04,EAP:EAP-linux-18.04,EAP teamcity-minimal-agent:EAP-linux-arm64-18.04,EAP:EAP-linux-18.04,EAP teamcity-agent:EAP-linux-arm64-18.04,EAP:EAP-linux-arm64-18.04-sudo:EAP-linux-18.04,EAP:EAP-linux-18.04-sudo" }) diff --git a/.teamcity/generated/PushLocalLinux2004.kts b/.teamcity/generated/PushLocalLinux2004.kts index 5843252c0..671508c7c 100644 --- a/.teamcity/generated/PushLocalLinux2004.kts +++ b/.teamcity/generated/PushLocalLinux2004.kts @@ -1,349 +1,325 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_linux_20_04 : BuildType({ -name = "Build and push linux 20.04" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-linux,EAP teamcity-minimal-agent:EAP-linux,EAP teamcity-agent:EAP-linux,EAP:EAP-linux-sudo:EAP-linux-arm64,EAP:EAP-linux-arm64-sudo" -vcs {root(TeamCityDockerImagesRepo)} -steps { -dockerCommand { -name = "pull ubuntu:20.04" -commandType = other { -subCommand = "pull" -commandArgs = "ubuntu:20.04" -} -} - -script { -name = "context teamcity-server:EAP-linux" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/buildAgent >> context/.dockerignore -echo TeamCity/temp >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-server:EAP-linux" -commandType = build { -source = file { -path = """context/generated/linux/Server/Ubuntu/20.04/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-server:EAP-linux -""".trimIndent() -} -param("dockerImage.platform", "linux") -} - -script { -name = "context teamcity-minimal-agent:EAP-linux" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-minimal-agent:EAP-linux" -commandType = build { -source = file { -path = """context/generated/linux/MinimalAgent/Ubuntu/20.04/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-minimal-agent:EAP-linux -""".trimIndent() -} -param("dockerImage.platform", "linux") -} - -script { -name = "context teamcity-agent:EAP-linux" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-linux" -commandType = build { -source = file { -path = """context/generated/linux/Agent/Ubuntu/20.04/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-linux -""".trimIndent() -} -param("dockerImage.platform", "linux") -} - -script { -name = "context teamcity-agent:EAP-linux-sudo" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-linux-sudo" -commandType = build { -source = file { -path = """context/generated/linux/Agent/Ubuntu/20.04-sudo/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-linux-sudo -""".trimIndent() -} -param("dockerImage.platform", "linux") -} - -//script { -//name = "context teamcity-agent:EAP-linux-arm64" -//scriptContent = """ -//echo 2> context/.dockerignore -//echo TeamCity >> context/.dockerignore -//""".trimIndent() -//} - -//dockerCommand { -//name = "build teamcity-agent:EAP-linux-arm64" -//commandType = build { -//source = file { -//path = """context/generated/linux/Agent/UbuntuARM/20.04/Dockerfile""" -//} -//contextDir = "context" -//commandArgs = "--no-cache" -//namesAndTags = """ -//teamcity-agent:EAP-linux-arm64 -//""".trimIndent() -//} -//param("dockerImage.platform", "linux") -//} -// -//script { -//name = "context teamcity-agent:EAP-linux-arm64-sudo" -//scriptContent = """ -//echo 2> context/.dockerignore -//echo TeamCity >> context/.dockerignore -//""".trimIndent() -//} -// -//dockerCommand { -//name = "build teamcity-agent:EAP-linux-arm64-sudo" -//commandType = build { -//source = file { -//path = """context/generated/linux/Agent/UbuntuARM/20.04-sudo/Dockerfile""" -//} -//contextDir = "context" -//commandArgs = "--no-cache" -//namesAndTags = """ -//teamcity-agent:EAP-linux-arm64-sudo -//""".trimIndent() -//} -//param("dockerImage.platform", "linux") -//} - -dockerCommand { -name = "tag teamcity-server:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-server:EAP-linux %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-minimal-agent:EAP-linux %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-linux" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-linux %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-linux-sudo" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-linux-sudo %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" -} -} - -//dockerCommand { -//name = "tag teamcity-agent:EAP-linux-arm64" -//commandType = other { -//subCommand = "tag" -//commandArgs = "teamcity-agent:EAP-linux-arm64 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" -//} -//} - -//dockerCommand { -//name = "tag teamcity-agent:EAP-linux-arm64-sudo" -//commandType = other { -//subCommand = "tag" -//commandArgs = "teamcity-agent:EAP-linux-arm64-sudo %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" -//} -//} - -dockerCommand { -name = "push teamcity-server:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-minimal-agent:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-linux" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-linux-sudo" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo -""".trimIndent() -removeImageAfterPush = false -} -} - -//dockerCommand { -//name = "push teamcity-agent:EAP-linux-arm64" -//commandType = push { -//namesAndTags = """ -//%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 -//""".trimIndent() -//removeImageAfterPush = false -//} -//} - -//dockerCommand { -//name = "push teamcity-agent:EAP-linux-arm64-sudo" -//commandType = push { -//namesAndTags = """ -//%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo -//""".trimIndent() -//removeImageAfterPush = false -//} -//} - // NOTE: The following steps are experimental identification of an EAP TeamCity agent Docker image - dockerCommand { - name = "Identify EAP TeamCity Agent Image - Linux-sudo" - - commandType = other { - subCommand = "tag" - commandArgs = "teamcity-agent:EAP-linux-sudo %docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%dockerImage.teamcity.buildNumber%-%build.counter%-linux-sudo" - } - } - - dockerCommand { - name = "Push identified EAP TeamCity Agent Image - Linux-sudo" - commandType = push { - namesAndTags = """ -%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%dockerImage.teamcity.buildNumber%-%build.counter%-linux-sudo -""".trimIndent() - removeImageAfterPush = false - } - } - - dockerCommand { - name = "Identify EAP TeamCity Agent Image" - - commandType = other { - subCommand = "tag" - commandArgs = "teamcity-agent:EAP-linux %docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%dockerImage.teamcity.buildNumber%-%build.counter%-linux" - } - } - - dockerCommand { - name = "Push identified EAP TeamCity Agent Image" - commandType = push { - namesAndTags = """ -%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%dockerImage.teamcity.buildNumber%-%build.counter%-linux -""".trimIndent() - removeImageAfterPush = false - } - } - -} -features { -freeDiskSpace { -requiredSpace = "8gb" -failBuild = true -} - - -dockerSupport { - cleanupPushedImages = true - loginToRegistry = on { - dockerRegistryId = "PROJECT_EXT_774,PROJECT_EXT_315" - } -} - - - swabra { -forceCleanCheckout = true -} -} -dependencies { -dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { -snapshot { onDependencyFailure = FailureAction.IGNORE -reuseBuilds = ReuseBuilds.ANY } -artifacts { -artifactRules = "TeamCity.zip!/**=>context/TeamCity" -} -} -} -params { -param("system.teamcity.agent.ensure.free.space", "8gb") -} -requirements { -} + name = "Build and push linux 20.04" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-linux,EAP teamcity-minimal-agent:EAP-linux,EAP teamcity-agent:EAP-linux,EAP:EAP-linux-sudo:EAP-linux-arm64,EAP:EAP-linux-arm64-sudo" + vcs { + root(TeamCityDockerImagesRepo) + } + + steps { + dockerCommand { + name = "pull ubuntu:20.04" + commandType = other { + subCommand = "pull" + commandArgs = "ubuntu:20.04" + } + } + + script { + name = "context teamcity-server:EAP-linux" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/buildAgent >> context/.dockerignore + echo TeamCity/temp >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-server:EAP-linux" + commandType = build { + source = file { + path = """context/generated/linux/Server/Ubuntu/20.04/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-server:EAP-linux + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + script { + name = "context teamcity-minimal-agent:EAP-linux" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-minimal-agent:EAP-linux" + commandType = build { + source = file { + path = """context/generated/linux/MinimalAgent/Ubuntu/20.04/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-minimal-agent:EAP-linux + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + script { + name = "context teamcity-agent:EAP-linux" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-linux" + commandType = build { + source = file { + path = """context/generated/linux/Agent/Ubuntu/20.04/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-linux + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + script { + name = "context teamcity-agent:EAP-linux-sudo" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-linux-sudo" + commandType = build { + source = file { + path = """context/generated/linux/Agent/Ubuntu/20.04-sudo/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-linux-sudo + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + script { + name = "context teamcity-agent:EAP-linux-arm64" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-linux-arm64" + commandType = build { + source = file { + path = """context/generated/linux/Agent/UbuntuARM/20.04/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-linux-arm64 + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + script { + name = "context teamcity-agent:EAP-linux-arm64-sudo" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-linux-arm64-sudo" + commandType = build { + source = file { + path = """context/generated/linux/Agent/UbuntuARM/20.04-sudo/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-linux-arm64-sudo + """.trimIndent() + } + param("dockerImage.platform", "linux") + } + + dockerCommand { + name = "tag teamcity-server:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-server:EAP-linux %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-minimal-agent:EAP-linux %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-linux" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-linux %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-linux-sudo" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-linux-sudo %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-linux-arm64" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-linux-arm64 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-linux-arm64-sudo" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-linux-arm64-sudo %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo" + } + } + + dockerCommand { + name = "push teamcity-server:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-minimal-agent:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-linux" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-linux-sudo" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-sudo + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-linux-arm64" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-linux-arm64-sudo" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-linux-arm64-sudo + """.trimIndent() + removeImageAfterPush = false + } + } + + } + features { + freeDiskSpace { + requiredSpace = "8gb" + failBuild = true + } + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + swabra { + forceCleanCheckout = true + } + } + dependencies { + dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { + snapshot { + onDependencyFailure = FailureAction.IGNORE + reuseBuilds = ReuseBuilds.ANY + } + artifacts { + artifactRules = "TeamCity.zip!/**=>context/TeamCity" + } + } + } + params { + param("system.teamcity.agent.ensure.free.space", "8gb") + } + requirements { + } }) diff --git a/.teamcity/generated/PushLocalWindows1803.kts b/.teamcity/generated/PushLocalWindows1803.kts index 1cfa2fa92..b2ec2a05c 100644 --- a/.teamcity/generated/PushLocalWindows1803.kts +++ b/.teamcity/generated/PushLocalWindows1803.kts @@ -1,18 +1,31 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_windows_1803 : BuildType({ -name = "ON PAUSE Build and push windows 1803" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-nanoserver-1803,EAP teamcity-minimal-agent:EAP-nanoserver-1803,EAP teamcity-agent:EAP-windowsservercore-1803,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1803,EAP" + name = "ON PAUSE Build and push windows 1803" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-nanoserver-1803,EAP teamcity-minimal-agent:EAP-nanoserver-1803,EAP teamcity-agent:EAP-windowsservercore-1803,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1803,EAP" }) diff --git a/.teamcity/generated/PushLocalWindows1809.kts b/.teamcity/generated/PushLocalWindows1809.kts index 614322e72..e651d1bcc 100644 --- a/.teamcity/generated/PushLocalWindows1809.kts +++ b/.teamcity/generated/PushLocalWindows1809.kts @@ -1,246 +1,265 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_windows_1809 : BuildType({ -name = "Build and push windows 1809" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-nanoserver-1809,EAP teamcity-minimal-agent:EAP-nanoserver-1809,EAP teamcity-agent:EAP-windowsservercore-1809,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1809,EAP" -vcs {root(TeamCityDockerImagesRepo)} -steps { -dockerCommand { -name = "pull mcr.microsoft.com/powershell:nanoserver-1809" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/powershell:nanoserver-1809" -} -} - -dockerCommand { -name = "pull mcr.microsoft.com/windows/nanoserver:1809" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/windows/nanoserver:1809" -} -} - -dockerCommand { -name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019" -} -} - -script { -name = "context teamcity-server:EAP-nanoserver-1809" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/buildAgent >> context/.dockerignore -echo TeamCity/temp >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-server:EAP-nanoserver-1809" -commandType = build { -source = file { -path = """context/generated/windows/Server/nanoserver/1809/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-server:EAP-nanoserver-1809 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-minimal-agent:EAP-nanoserver-1809" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-minimal-agent:EAP-nanoserver-1809" -commandType = build { -source = file { -path = """context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-minimal-agent:EAP-nanoserver-1809 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-agent:EAP-windowsservercore-1809" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-windowsservercore-1809" -commandType = build { -source = file { -path = """context/generated/windows/Agent/windowsservercore/1809/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-windowsservercore-1809 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-agent:EAP-nanoserver-1809" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-nanoserver-1809" -commandType = build { -source = file { -path = """context/generated/windows/Agent/nanoserver/1809/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-nanoserver-1809 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -dockerCommand { -name = "tag teamcity-server:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-server:EAP-nanoserver-1809 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-minimal-agent:EAP-nanoserver-1809 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-windowsservercore-1809" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-windowsservercore-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-nanoserver-1809" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-nanoserver-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" -} -} - -dockerCommand { -name = "push teamcity-server:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-minimal-agent:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-windowsservercore-1809" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-nanoserver-1809" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 -""".trimIndent() -removeImageAfterPush = false -} -} + name = "Build and push windows 1809" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-nanoserver-1809,EAP teamcity-minimal-agent:EAP-nanoserver-1809,EAP teamcity-agent:EAP-windowsservercore-1809,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1809,EAP" + vcs { + root(TeamCityDockerImagesRepo) + } -} -features { -freeDiskSpace { -requiredSpace = "43gb" -failBuild = true -} -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -swabra { -forceCleanCheckout = true -} -} -dependencies { -dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { -snapshot { onDependencyFailure = FailureAction.IGNORE -reuseBuilds = ReuseBuilds.ANY } -artifacts { -artifactRules = "TeamCity.zip!/**=>context/TeamCity" -} -} -} -params { -param("system.teamcity.agent.ensure.free.space", "43gb") -} -requirements { -contains("teamcity.agent.jvm.os.name", "Windows 10") -} + steps { + dockerCommand { + name = "pull mcr.microsoft.com/powershell:nanoserver-1809" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/powershell:nanoserver-1809" + } + } + + dockerCommand { + name = "pull mcr.microsoft.com/windows/nanoserver:1809" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/windows/nanoserver:1809" + } + } + + dockerCommand { + name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019" + } + } + + script { + name = "context teamcity-server:EAP-nanoserver-1809" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/buildAgent >> context/.dockerignore + echo TeamCity/temp >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-server:EAP-nanoserver-1809" + commandType = build { + source = file { + path = """context/generated/windows/Server/nanoserver/1809/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-server:EAP-nanoserver-1809 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-minimal-agent:EAP-nanoserver-1809" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-minimal-agent:EAP-nanoserver-1809" + commandType = build { + source = file { + path = """context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-minimal-agent:EAP-nanoserver-1809 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-agent:EAP-windowsservercore-1809" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-windowsservercore-1809" + commandType = build { + source = file { + path = """context/generated/windows/Agent/windowsservercore/1809/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-windowsservercore-1809 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-agent:EAP-nanoserver-1809" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-nanoserver-1809" + commandType = build { + source = file { + path = """context/generated/windows/Agent/nanoserver/1809/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-nanoserver-1809 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + dockerCommand { + name = "tag teamcity-server:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-server:EAP-nanoserver-1809 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-minimal-agent:EAP-nanoserver-1809 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-windowsservercore-1809" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-windowsservercore-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-nanoserver-1809" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-nanoserver-1809 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809" + } + } + + dockerCommand { + name = "push teamcity-server:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-minimal-agent:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-windowsservercore-1809" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-nanoserver-1809" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-1809 + """.trimIndent() + removeImageAfterPush = false + } + } + + } + features { + freeDiskSpace { + requiredSpace = "43gb" + failBuild = true + } + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + swabra { + forceCleanCheckout = true + } + } + dependencies { + dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { + snapshot { + onDependencyFailure = FailureAction.IGNORE + reuseBuilds = ReuseBuilds.ANY + } + artifacts { + artifactRules = "TeamCity.zip!/**=>context/TeamCity" + } + } + } + params { + param("system.teamcity.agent.ensure.free.space", "43gb") + } + requirements { + contains("system.agent.name", "docker") + contains("system.agent.name", "windows10") + } }) diff --git a/.teamcity/generated/PushLocalWindows1903.kts b/.teamcity/generated/PushLocalWindows1903.kts index adcd8a4bd..2228a0ddb 100644 --- a/.teamcity/generated/PushLocalWindows1903.kts +++ b/.teamcity/generated/PushLocalWindows1903.kts @@ -1,18 +1,31 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_windows_1903 : BuildType({ -name = "ON PAUSE Build and push windows 1903" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-nanoserver-1903,EAP teamcity-minimal-agent:EAP-nanoserver-1903,EAP teamcity-agent:EAP-windowsservercore-1903,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1903,EAP" + name = "ON PAUSE Build and push windows 1903" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-nanoserver-1903,EAP teamcity-minimal-agent:EAP-nanoserver-1903,EAP teamcity-agent:EAP-windowsservercore-1903,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1903,EAP" }) diff --git a/.teamcity/generated/PushLocalWindows1909.kts b/.teamcity/generated/PushLocalWindows1909.kts index db8436462..15b754793 100644 --- a/.teamcity/generated/PushLocalWindows1909.kts +++ b/.teamcity/generated/PushLocalWindows1909.kts @@ -1,18 +1,31 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_windows_1909 : BuildType({ -name = "ON PAUSE Build and push windows 1909" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-nanoserver-1909,EAP teamcity-minimal-agent:EAP-nanoserver-1909,EAP teamcity-agent:EAP-windowsservercore-1909,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1909,EAP" + name = "ON PAUSE Build and push windows 1909" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-nanoserver-1909,EAP teamcity-minimal-agent:EAP-nanoserver-1909,EAP teamcity-agent:EAP-windowsservercore-1909,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-1909,EAP" }) diff --git a/.teamcity/generated/PushLocalWindows2004.kts b/.teamcity/generated/PushLocalWindows2004.kts index ee6d8d54b..95134fc76 100644 --- a/.teamcity/generated/PushLocalWindows2004.kts +++ b/.teamcity/generated/PushLocalWindows2004.kts @@ -1,246 +1,265 @@ +// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ... +// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... +// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY. package generated import jetbrains.buildServer.configs.kotlin.v2019_2.* import jetbrains.buildServer.configs.kotlin.v2019_2.ui.* -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo +import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs object push_local_windows_2004 : BuildType({ -name = "Build and push windows 2004" -buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" -description = "teamcity-server:EAP-nanoserver-2004,EAP teamcity-minimal-agent:EAP-nanoserver-2004,EAP teamcity-agent:EAP-windowsservercore-2004,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-2004,EAP" -vcs {root(TeamCityDockerImagesRepo)} -steps { -dockerCommand { -name = "pull mcr.microsoft.com/powershell:nanoserver-2004" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/powershell:nanoserver-2004" -} -} - -dockerCommand { -name = "pull mcr.microsoft.com/windows/nanoserver:2004" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/windows/nanoserver:2004" -} -} - -dockerCommand { -name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004" -commandType = other { -subCommand = "pull" -commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004" -} -} - -script { -name = "context teamcity-server:EAP-nanoserver-2004" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/buildAgent >> context/.dockerignore -echo TeamCity/temp >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-server:EAP-nanoserver-2004" -commandType = build { -source = file { -path = """context/generated/windows/Server/nanoserver/2004/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-server:EAP-nanoserver-2004 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-minimal-agent:EAP-nanoserver-2004" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-minimal-agent:EAP-nanoserver-2004" -commandType = build { -source = file { -path = """context/generated/windows/MinimalAgent/nanoserver/2004/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-minimal-agent:EAP-nanoserver-2004 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-agent:EAP-windowsservercore-2004" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-windowsservercore-2004" -commandType = build { -source = file { -path = """context/generated/windows/Agent/windowsservercore/2004/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-windowsservercore-2004 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -script { -name = "context teamcity-agent:EAP-nanoserver-2004" -scriptContent = """ -echo 2> context/.dockerignore -echo TeamCity/webapps >> context/.dockerignore -echo TeamCity/devPackage >> context/.dockerignore -echo TeamCity/lib >> context/.dockerignore -""".trimIndent() -} - -dockerCommand { -name = "build teamcity-agent:EAP-nanoserver-2004" -commandType = build { -source = file { -path = """context/generated/windows/Agent/nanoserver/2004/Dockerfile""" -} -contextDir = "context" -commandArgs = "--no-cache" -namesAndTags = """ -teamcity-agent:EAP-nanoserver-2004 -""".trimIndent() -} -param("dockerImage.platform", "windows") -} - -dockerCommand { -name = "tag teamcity-server:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-server:EAP-nanoserver-2004 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "tag teamcity-minimal-agent:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-minimal-agent:EAP-nanoserver-2004 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-windowsservercore-2004" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-windowsservercore-2004 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" -} -} - -dockerCommand { -name = "tag teamcity-agent:EAP-nanoserver-2004" -commandType = other { -subCommand = "tag" -commandArgs = "teamcity-agent:EAP-nanoserver-2004 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" -} -} - -dockerCommand { -name = "push teamcity-server:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-minimal-agent:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-windowsservercore-2004" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004 -""".trimIndent() -removeImageAfterPush = false -} -} - -dockerCommand { -name = "push teamcity-agent:EAP-nanoserver-2004" -commandType = push { -namesAndTags = """ -%docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 -""".trimIndent() -removeImageAfterPush = false -} -} + name = "Build and push windows 2004" + buildNumberPattern="%dockerImage.teamcity.buildNumber%-%build.counter%" + description = "teamcity-server:EAP-nanoserver-2004,EAP teamcity-minimal-agent:EAP-nanoserver-2004,EAP teamcity-agent:EAP-windowsservercore-2004,EAP-windowsservercore,-windowsservercore:EAP-nanoserver-2004,EAP" + vcs { + root(TeamCityDockerImagesRepo) + } -} -features { -freeDiskSpace { -requiredSpace = "43gb" -failBuild = true -} -dockerSupport { -cleanupPushedImages = true -loginToRegistry = on { -dockerRegistryId = "PROJECT_EXT_774" -} -} -swabra { -forceCleanCheckout = true -} -} -dependencies { -dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { -snapshot { onDependencyFailure = FailureAction.IGNORE -reuseBuilds = ReuseBuilds.ANY } -artifacts { -artifactRules = "TeamCity.zip!/**=>context/TeamCity" -} -} -} -params { -param("system.teamcity.agent.ensure.free.space", "43gb") -} -requirements { -contains("teamcity.agent.jvm.os.name", "Windows 10") -} + steps { + dockerCommand { + name = "pull mcr.microsoft.com/powershell:nanoserver-2004" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/powershell:nanoserver-2004" + } + } + + dockerCommand { + name = "pull mcr.microsoft.com/windows/nanoserver:2004" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/windows/nanoserver:2004" + } + } + + dockerCommand { + name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004" + commandType = other { + subCommand = "pull" + commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004" + } + } + + script { + name = "context teamcity-server:EAP-nanoserver-2004" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/buildAgent >> context/.dockerignore + echo TeamCity/temp >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-server:EAP-nanoserver-2004" + commandType = build { + source = file { + path = """context/generated/windows/Server/nanoserver/2004/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-server:EAP-nanoserver-2004 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-minimal-agent:EAP-nanoserver-2004" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-minimal-agent:EAP-nanoserver-2004" + commandType = build { + source = file { + path = """context/generated/windows/MinimalAgent/nanoserver/2004/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-minimal-agent:EAP-nanoserver-2004 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-agent:EAP-windowsservercore-2004" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-windowsservercore-2004" + commandType = build { + source = file { + path = """context/generated/windows/Agent/windowsservercore/2004/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-windowsservercore-2004 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + script { + name = "context teamcity-agent:EAP-nanoserver-2004" + scriptContent = """ + echo 2> context/.dockerignore + echo TeamCity/webapps >> context/.dockerignore + echo TeamCity/devPackage >> context/.dockerignore + echo TeamCity/lib >> context/.dockerignore + """.trimIndent() + } + + dockerCommand { + name = "build teamcity-agent:EAP-nanoserver-2004" + commandType = build { + source = file { + path = """context/generated/windows/Agent/nanoserver/2004/Dockerfile""" + } + contextDir = "context" + commandArgs = "--no-cache" + namesAndTags = """ + teamcity-agent:EAP-nanoserver-2004 + """.trimIndent() + } + param("dockerImage.platform", "windows") + } + + dockerCommand { + name = "tag teamcity-server:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-server:EAP-nanoserver-2004 %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "tag teamcity-minimal-agent:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-minimal-agent:EAP-nanoserver-2004 %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-windowsservercore-2004" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-windowsservercore-2004 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004" + } + } + + dockerCommand { + name = "tag teamcity-agent:EAP-nanoserver-2004" + commandType = other { + subCommand = "tag" + commandArgs = "teamcity-agent:EAP-nanoserver-2004 %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004" + } + } + + dockerCommand { + name = "push teamcity-server:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-server%docker.buildImagePostfix%:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-minimal-agent:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-minimal-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-windowsservercore-2004" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-windowsservercore-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + dockerCommand { + name = "push teamcity-agent:EAP-nanoserver-2004" + commandType = push { + namesAndTags = """ + %docker.buildRepository%teamcity-agent%docker.buildImagePostfix%:EAP-nanoserver-2004 + """.trimIndent() + removeImageAfterPush = false + } + } + + } + features { + freeDiskSpace { + requiredSpace = "43gb" + failBuild = true + } + dockerSupport { + cleanupPushedImages = true + loginToRegistry = on { + dockerRegistryId = "PROJECT_EXT_774" + } + } + swabra { + forceCleanCheckout = true + } + } + dependencies { + dependency(AbsoluteId("TC_Trunk_BuildDistDocker")) { + snapshot { + onDependencyFailure = FailureAction.IGNORE + reuseBuilds = ReuseBuilds.ANY + } + artifacts { + artifactRules = "TeamCity.zip!/**=>context/TeamCity" + } + } + } + params { + param("system.teamcity.agent.ensure.free.space", "43gb") + } + requirements { + contains("system.agent.name", "docker") + contains("system.agent.name", "windows10") + } }) diff --git a/.teamcity/hosted/BuildAndPushHosted.kts b/.teamcity/hosted/BuildAndPushHosted.kts index 1f586a8a3..f372301c4 100644 --- a/.teamcity/hosted/BuildAndPushHosted.kts +++ b/.teamcity/hosted/BuildAndPushHosted.kts @@ -32,7 +32,7 @@ echo TeamCity/buildAgent >> context/.dockerignore echo TeamCity/temp >> context/.dockerignore """.trimIndent() } - + dockerCommand { name = "build teamcity-server-staging" commandType = build { diff --git a/.teamcity/test/ImageValidation.kts b/.teamcity/test/ImageValidation.kts deleted file mode 100644 index daa47da35..000000000 --- a/.teamcity/test/ImageValidation.kts +++ /dev/null @@ -1,224 +0,0 @@ -import java.lang.Exception -import java.lang.NumberFormatException -import java.lang.System -import java.lang.Void -import java.util.Objects -import java.util.concurrent.TimeUnit - -/** - * Target values used for validation purposes. - */ -object ValidationConstants { - const val ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT = 5.0f -} - -/** - * Mark-up exception class for failed validation of Docker images. - */ -class DockerImageValidationException(message: String) : Exception(message) - -/** - * Executes command. - * @param command - command to be execution - * @param redirectStderr - indicates if error output must be captured along with ... - * ... stdout - * @return result of command's execution ; null in case of exception - */ -fun executeCommand(command: String, redirectStderr: Boolean = true, timeoutSec: Long = 60): String? { - return runCatching { - // -- converting command to list containing the arguments - val args = command.split(Regex("(?.-". - */ -fun getPrevDockerImageId(imageId: String): String { - var curImageTag = imageId.split(":")[1] - var curImageTagElems = curImageTag.split(".") - - if (curImageTagElems.size < 2) { - // image is highly likely doesn't correspond to pattern - throw IllegalArgumentException("Unable to auto-determine previous image tag - it doesn't correspond to pattern: $imageId") - } - - // handling 2 types: 2022.04-OS and 2022.04.2-OS - val isMinorRelease = curImageTagElems.size > 2 - - var imageBuildNum = if (isMinorRelease) curImageTagElems[2].split("-")[0] - else curImageTagElems[1].split("-")[0] - - var oldBuildNumber = Integer.parseInt(imageBuildNum) - 1 - - // -- construct old image tag based on retrieved information from the current one - // -- -- adding "0" since build number has at least 2 digits - val oldBuildNumString = if (oldBuildNumber < 10 && !isMinorRelease) ("0" + oldBuildNumber) - else oldBuildNumber - - // Replace current image's numberic part of tag with determined "old" value, e.g. "2022.04.2-" -> "2022.04.1-" - val originalImageTagPart = if (isMinorRelease) (curImageTagElems[0] + "." + curImageTagElems[1] + "." + imageBuildNum + "-") - else (curImageTagElems[0] + "." + imageBuildNum + "-") - val determinedOldImageTagPart = if (isMinorRelease) (curImageTagElems[0] + "." + curImageTagElems[1] + "." + oldBuildNumString + "-") - else (curImageTagElems[0] + "." + oldBuildNumString + "-") - - val oldImageId = imageId.replace(originalImageTagPart, determinedOldImageTagPart) - return oldImageId -} - - -/** - * Tries to pull Docker image from registry. - * @param name - docker image fully-qualified domain name - * @return true if image had been successfully pulled, false otherwise - */ -fun pullDockerImage(name: String): Boolean { - val cmdResult = this.executeCommand("docker pull $name", true) ?: "" - - // using success messages since some errors from docker daemon (e.g. invalid platform type) are not ... - // ... captured by Kotlin's ProcessBuilder. - val successMessages = arrayOf("Pull complete", "Image is up to date") - return successMessages.any { cmdResult.contains(it, ignoreCase = true) } -} - - -/** - * Validates Docker image size. - * Criteria: it shouldn't increase by more than threshold (@see ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT). - * @param currentName - name of original Docker image - * @param previousName - name of previous Docker image - * @return true if image size increase suppressed given threshold; false otherwise (including situation when ... - * ... it wasn't possible to determine any of image sizes) - */ -fun imageSizeChangeSuppressesThreshold(currentName: String, previousName: String, threshold: Float): Boolean { - // -- get size of current image - val curSize = this.getDockerImageSize(currentName) - if (curSize == null) { - System.err.println("Image does not exist on the agent: $currentName") - return false - } - - // -- report image size to TeamCity - this.reportTeamCityStatistics("SIZE-$currentName", curSize) - - // -- get size of previous image - val prevImagePullSucceeded = this.pullDockerImage(previousName) - val prevSize = this.getDockerImageSize(previousName) - if (!prevImagePullSucceeded || prevSize == null) { - System.err.println("Unable to get size of previous image: $previousName") - return false - } - - // -- calculates image increase & notify if exceeds threshold - val percentageIncrease = this.getPercentageIncrease(curSize, prevSize) - return (percentageIncrease > threshold) -} - -/** - * Reports statistics to TeamCity via Service Messages. - * @param key metric ID - * @param value metricValue - * - * TODO: Think about generic 'value' type - */ -fun reportTeamCityStatistics(key: String, value: Int) { - System.out.println("##teamcity[buildStatisticValue key='$key' value='$value']") -} - -fun main(args: Array) { - if (args.size < 1) { - throw IllegalArgumentException("Not enough CLI arguments.") - } - val imageName = args[0] - - var prevImageName = "" - if (args.size >= 2) { - // -- take image name - prevImageName = args[1] - } else { - // -- previous image name was not explicitly specified => try to determine automatically )by pattern) - try { - prevImageName = this.getPrevDockerImageId(imageName) - } catch (ex: IndexOutOfBoundsException) { - throw IllegalArgumentException("Unable to determine previous image tag from given ID: $imageName \n" + - "Expected image name pattern: \".-\"") - } - } - - val imageSizeChangeSuppressesThreshold = this.imageSizeChangeSuppressesThreshold(imageName, - prevImageName, - ValidationConstants.ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT) - if (imageSizeChangeSuppressesThreshold) { - throw DockerImageValidationException("Image $imageName size compared to previous ($prevImageName) " + - "suppresses ${ValidationConstants.ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT}% threshold.") - } -} - -main(args) diff --git a/README.md b/README.md index 03332a340..1c288b1e5 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This minimal image adds just a TeamCity agent without any tools like VCS clients ### Agent (jetbrains/teamcity-agent) -[![jetbrains/teamcity-agent](https://img.shields.io/docker/pulls/jetbrains/teamcity-agent.svg)](https://hub.docker.com/r/jetbrains/teamcity-agent/) +[![jetbrains/teamcity-agent](https://img.shields.io/docker/pulls/jetbrains/teamcity-agent.svg)](https://hub.docker.com/r/jetbrains/teamcity-agent/) This image adds a TeamCity agent suitable for Java and .NET development. @@ -40,7 +40,7 @@ This image adds a TeamCity agent suitable for Java and .NET development. - Download the required TeamCity [_.tar.gz_ file](https://www.jetbrains.com/teamcity/download/#section=section-get). For instance ```wget -c https://download.jetbrains.com/teamcity/TeamCity-2021.2.tar.gz -O - | tar -xz -C context``` - Unpack this file into the directory [context/TeamCity](context/TeamCity) within the cloned repository. - To add plugins to TeamCity agents run the _context.sh_ or _context.cmd_ script. This is optional as otherwise the TeamCity agents will load plugins by themselves on first launch. - - Build docker images using a coresponding _.cmd_ or _.sh_ script file in [context/generated](context/generated) directory. + - Build docker images using a corresponding _.cmd_ or _.sh_ script file in [context/generated](context/generated) directory. - Check the docker images by running ```docker-compose up``` in the directories like [checks/windows-local](checks/windows-local) or [checks/linux-local](checks/linux-local). - Push all repo changes. @@ -50,7 +50,11 @@ This image adds a TeamCity agent suitable for Java and .NET development. - Clone this repository. - Download the required TeamCity [_.tar.gz_ file](https://www.jetbrains.com/teamcity/download/#section=section-get). For instance ```wget -c https://download.jetbrains.com/teamcity/TeamCity-2021.2.tar.gz -O - | tar -xz -C context``` - Unpack this file into the directory [context/TeamCity](context/TeamCity) within the cloned repository. -- Generate an image using a coresponding _.cmd_ or _.sh_ script file in [context/generated](context/generated) directory. +- Generate an image using a corresponding _.cmd_ or _.sh_ script file in [context/generated](context/generated) directory. + +### Utilities +- [TeamCity Docker Images - tools](tool) - tools used within the release process of Docker Images. +- [Automation Framework](tool/automation/framework) - framework for simplification of Docker Images release process. ### Bugs/issues/problems diff --git a/generate.cmd b/generate.cmd index 243469768..5caa50d94 100644 --- a/generate.cmd +++ b/generate.cmd @@ -2,4 +2,5 @@ call tool\build-tool.cmd rmdir "generated" /s /q rmdir "context/generated" /s /q bin\TeamCity.Docker.exe generate -s configs -f "configs/common.config;configs/local.config;configs/windows.config;configs/linux.config;configs/linuxARM.config" -t generated -c context +:: PROJECT_EXT_774 - global docker registry with writable access bin\TeamCity.Docker.exe generate -s configs -f "configs/common.config;configs/version.config;configs/internal.config;configs/windows.config;configs/linux.config;configs/linuxARM.config" -c context -t context/generated -d .teamcity/generated -r "PROJECT_EXT_774" -b TC_Trunk_BuildDistDocker diff --git a/generate.sh b/generate.sh index 7e583adbc..dfb1c834c 100755 --- a/generate.sh +++ b/generate.sh @@ -3,4 +3,5 @@ bash tool/build-tool.sh rm -rf "generated" rm -rf "context/generated" bin/TeamCity.Docker generate -s configs -f "configs/common.config;configs/local.config;configs/windows.config;configs/linux.config;configs/linuxARM.config" -c context -t generated +# PROJECT_EXT_774 - global docker registry with writable access bin/TeamCity.Docker generate -s configs -f "configs/common.config;configs/version.config;configs/internal.config;configs/windows.config;configs/linux.config;configs/linuxARM.config" -c context -t context/generated -d .teamcity/generated -r "PROJECT_EXT_774" -b TC_Trunk_BuildDistDocker diff --git a/tool/README.md b/tool/README.md new file mode 100644 index 000000000..a94a74df9 --- /dev/null +++ b/tool/README.md @@ -0,0 +1,60 @@ +# TeamCity Docker Images - tools +Tools dedicated to simplification and enhancements of [TeamCity](https://www.jetbrains.com/teamcity/) Docker Images release process. + +# 1. Dockerfiles & Build Configurations generator +[TeamCity.Docker](TeamCity.Docker) is a utility application (C#) that generates Dockerfiles along with Kotlin DSL for build +configurations aimed at creating and publishing TeamCity Docker Images for different platforms. + +## 1.1 Configuration options +The program accepts verbs (main options), as well as their configuration (sub-options). + +- `generate` - generate docker and readme files. +- `build` - Build docker images for session. + +### 1.1.1 Generate Dockerfiles +`generate` verb specified the necessity to generate Dockerfile. It has the following options: + +| Option | short flag | Required | Description | +|------------|------------|----------|---------------------------------------------------------| +| `target` | `-t` | true | Path to directory for generating docker files. | +| `source` | `-s` | false | Path to configuration directory. | +| `context` | `-c` | false | Path to the context directory. | +| `files` | `-f` | false | Semicolon separated configuration file. Separator - `;` | +| `dsl` | `-d` | false | Path to directory for teamcity DSL script settings.kts. | +| `build` | `-b` | false | TeamCity build configuration id. | +| `registry` | `-r` | false | TeamCity docker registry id. | +| `verbose` | `-v` | false | Add it for detailed output." | + +Example: +``` +generate -s configs -f "configs/common.config;configs/local.config;configs/windows.config;configs/linux.config;configs/linuxARM.config" -c context -t generated +``` + +### 1.1.2 Build Docker images +`build` verb specifies the necessity to build Docker images for session. It has the following options: + +| Option | short flag | Required | Description | +|-----------|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------| +| `source` | `-s` | false | Path to configuration directory. | +| `files` | `-f` | false | Semicolon separated configuration file. Separator - `;` | +| `context` | `-c` | false | Path to the context directory. | +| `docker` | `-d` | false | The Docker Engine endpoint like tcp://localhost:2375 (defaults: npipe://./pipe/docker_engine fo windows and unix:///var/run/docker.sock for others). | +| `verbose` | `-v` | false | Specified necessity for verbose (detailed) output. | +| `regex` | `-r` | false | Regular expression for filtering an internal build graph. Used for development purposes mostly. | + +# 2. Automation utilities +[Automation utilities](automation/framework) contains utilities that simplify release process. Please, follow the link for the detailed documentation. + +# 3. TeamCity Parameters + +Due to the necessity to keep multiple parameters masked, in order to run the configurations located within current repository, +it's mandatory to configure (persist) some of them within TeamCity Server. Please, note that the scope of their accessibility +must correspond to build configurations created based on DSL stored within this repository. + +| Parameter | Description | +|----------------------------------|-------------------------------------------------------------------------------------------| +| `docker.stagingRepository.login` | Login for Docker staging registry. Must be stored as TeamCity password (masked). | +| `docker.stagingRepository.token` | Password for Docker staging registry. Must be stored as TeamCity password (masked). | +| `docker.buildRepository` | Staging repository link. Please, note that it should not contain image name or tag. | +| `docker.buildImagePostfix` | Postfix for staging Docker Images. It will be added to the name of the image, not tag. | +| `docker.deployRepository` | "Production" repository which will contain final images within `docker.buildImagePostfix` | diff --git a/tool/TeamCity.Docker/Constants/TeamCityConstants.cs b/tool/TeamCity.Docker/Constants/TeamCityConstants.cs new file mode 100644 index 000000000..9db4c1ce8 --- /dev/null +++ b/tool/TeamCity.Docker/Constants/TeamCityConstants.cs @@ -0,0 +1,22 @@ +namespace TeamCity.Docker.Constants +{ + /// + /// Describes TeamCity-related constants + /// + public static class TeamCityConstants + { + /// + /// Failure conditions + /// + public static class Conditions { + public const string REGEXP = "BuildFailureOnText.ConditionType.REGEXP"; + } + + /// + /// Build Configurations inside of TeamCIty that're referenced within the code + /// + public static class TrunkConfigurations { + public const string BUILD_DIST_DOCKER = "TC_Trunk_BuildDistDocker"; + } + } +} diff --git a/tool/TeamCity.Docker/GenerateCommand.cs b/tool/TeamCity.Docker/GenerateCommand.cs index ca4328b72..9058c081c 100644 --- a/tool/TeamCity.Docker/GenerateCommand.cs +++ b/tool/TeamCity.Docker/GenerateCommand.cs @@ -1,4 +1,4 @@ -// ReSharper disable ClassNeverInstantiated.Global +// ReSharper disable ClassNeverInstantiated.Global namespace TeamCity.Docker { using System; @@ -38,6 +38,10 @@ public GenerateCommand( _generators = generators ?? throw new ArgumentNullException(nameof(generators)); } + /// + /// Generates Dockerfiles. + /// + /// Completed task in case succeeded. public Task Run() { var templates = _configurationExplorer.Explore(_options.SourcePath, _options.ConfigurationFiles); @@ -46,6 +50,7 @@ public Task Run() return Task.FromResult(Result.Error); } + // convert configuration parameters into graph for further processing var graph = _buildGraphFactory.Create(templates.Value); if (graph.State == Result.Error) { diff --git a/tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs b/tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs index af7ba1cb3..ccead8cbf 100644 --- a/tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs +++ b/tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs @@ -9,6 +9,7 @@ namespace TeamCity.Docker using Generic; using IoC; using Model; + using Constants; internal class TeamCityKotlinSettingsGenerator : IGenerator { @@ -39,6 +40,14 @@ public TeamCityKotlinSettingsGenerator( _nodesDescriptionsFactory = nodesDescriptionFactory ?? throw new ArgumentNullException(nameof(nodesDescriptionFactory)); } + /// + /// Generates the following TeamCity Build Configurations (KotlinDSL) responsible for: + /// - 1. Build and push to local registry. Name pattern: "PushLocal*.kts". + /// - 2. Publishing docker manifests into registry. Name pattern: "PublishHub*.kts". + /// - 3. Pushing into Dockerhub. Name pattern: "PushHub*.kts" + /// + /// graph - RDF graph containing description of target TeamCity build chain. + /// public void Generate(IGraph graph) { if (graph == null) throw new ArgumentNullException(nameof(graph)); @@ -135,23 +144,32 @@ from tag in image.File.Tags.Skip(1) group image by tag group grp by grp.Key.ToLowerInvariant() == "latest" ? "latest" : "version"; + foreach (var group in publishOnHubGroups) { - var buildTypeId = $"publish_hub_{NormalizeName(group.Key)}"; - publishOnHubBuildTypes.Add(buildTypeId); - graph.TryAddNode(AddFile(buildTypeId, CreateManifestBuildConfiguration(buildTypeId, DeployRepositoryName, $"Publish as {group.Key}", group.ToList(), string.Empty, false, pushOnHubBuildTypes.ToArray())), out _); + string publishToDockerhubBuildId = $"publish_hub_{NormalizeName(group.Key)}"; + publishOnHubBuildTypes.Add(publishToDockerhubBuildId); + graph.TryAddNode(AddFile(publishToDockerhubBuildId,CreateManifestBuildConfiguration(publishToDockerhubBuildId, + DeployRepositoryName, $"Publish as {group.Key}", + group.ToList(), string.Empty, false, + pushOnHubBuildTypes.ToArray())), out _); } hubBuildTypes.AddRange(publishOnHubBuildTypes); + // Validation of Docker Image Size + const string validationBuildTypeId = "image_validation"; + graph.TryAddNode(AddFile(validationBuildTypeId, CreateImageValidationConfig(validationBuildTypeId, allImages, BuildImagePostfix)), out _); + localBuildTypes.Add(validationBuildTypeId); + // Local project // ReSharper disable once UseObjectOrCollectionInitializer var lines = new List(); lines.Add("object LocalProject : Project({"); - lines.Add("name = \"Staging registry\""); + lines.Add("\t name = \"Staging registry\""); foreach (var buildType in localBuildTypes.Distinct()) { - lines.Add($"buildType({NormalizeFileName(buildType)}.{buildType})"); + lines.Add($"\t buildType({NormalizeFileName(buildType)}.{buildType})"); } lines.Add("})"); @@ -160,10 +178,10 @@ group image by tag // Hub project lines.Add("object HubProject : Project({"); - lines.Add("name = \"Docker hub\""); + lines.Add("\t name = \"Docker hub\""); foreach (var buildType in hubBuildTypes.Distinct()) { - lines.Add($"buildType({NormalizeFileName(buildType)}.{buildType})"); + lines.Add($"\t buildType({NormalizeFileName(buildType)}.{buildType})"); } lines.Add("})"); @@ -172,22 +190,46 @@ group image by tag lines.Clear(); } + /// + /// Adds imports on top of the Build Configuration (Kotlin DSL) file. + /// + /// target KotlinDSL file + /// import lines to be added. Please, check method's body to see pre-defined importing packages. + /// private FileArtifact AddFile(string fileName, IEnumerable lines) { var curLines = new List { + "// NOTE: THIS IS AN AUTO-GENERATED FILE. IT HAD BEEN CREATED USING TEAMCITY.DOCKER PROJECT. ...", + "// ... IF NEEDED, PLEASE, EDIT DSL GENERATOR RATHER THAN THE FILES DIRECTLY. ... ", + "// ... FOR MORE DETAILS, PLEASE, REFER TO DOCUMENTATION WITHIN THE REPOSITORY.", "package generated", string.Empty, "import jetbrains.buildServer.configs.kotlin.v2019_2.*", "import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*", - "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script", "import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot", - "import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport", - "import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace", // ReSharper disable once StringLiteralTypo "import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.swabra", - "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand", "import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo", + // -- build features + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport", + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.freeDiskSpace", + // -- Failure Conditions + "import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnText", + "import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnText", + "import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric", + "import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange", + // -- Build Steps + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.kotlinFile", + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle", + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script", + "import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand", + // -- All Triggers + "import jetbrains.buildServer.configs.kotlin.v2019_2.Trigger", + "import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger", + "import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.finishBuildTrigger", + "import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs", + string.Empty }; // ReSharper disable once StringLiteralTypo @@ -222,15 +264,22 @@ private IEnumerable FixFileName(IEnumerable chars) } } + /// + /// Creates KotlinDSL's TeamCity build configuration for the creation and uploading of TeamCity's Docker images. + /// + /// ID of build configuration within TeamCity + /// target platform for the images (e.g. specific distributive of Linux, Windows) + /// list of Docker images + /// types of TeamCity builds (e.g. publish_local - the naming is up to user) + /// private IEnumerable CreatePushBuildConfiguration(string buildTypeId, string platform, IEnumerable allImages, params string[] buildBuildTypes) { var images = allImages.Where(i => i.File.Platform == platform).ToList(); - yield return $"object {buildTypeId}: BuildType("; - yield return "{"; - yield return $"name = \"Push {platform}\""; - yield return _buildNumberPattern; + yield return $"object {buildTypeId}: BuildType(" + "{"; + yield return $"\t name = \"Push {platform}\""; + yield return $"\t{_buildNumberPattern}"; - yield return "steps {"; + yield return "\t steps {"; foreach (var image in images) { // docker pull @@ -239,82 +288,212 @@ private IEnumerable CreatePushBuildConfiguration(string buildTypeId, str var repoTag = $"{BuildRepositoryName}{repo}"; foreach (var pullCommand in CreatePullCommand(repoTag, repo)) { - yield return pullCommand; + 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 tagCommand; + yield return $"\t\t{tagCommand}"; } foreach (var pushCommand in CreatePushCommand($"{newRepo}", repo, tag)) { - yield return pushCommand; + yield return $"\t\t{pushCommand}"; } } - yield return "}"; + yield return "\t }"; - yield return "features {"; + yield return "\t features {"; var weight = images.Sum(i => i.File.Weight.Value); if (weight > 0) { foreach (var feature in CreateFreeDiskSpaceFeature(weight)) { - yield return feature; + yield return $"\t\t {feature}"; } } foreach (var feature in CreateDockerFeature()) { - yield return feature; + yield return $"\t\t {feature}"; } // ReSharper disable once StringLiteralTypo foreach (var feature in CreateSwabraFeature()) { - yield return feature; + yield return $"\t\t {feature}"; } - yield return "}"; + yield return "\t }"; foreach (var param in CreateSpaceParams(weight)) { - yield return param; + yield return $"\t{param}"; } var requirements = images.SelectMany(i => i.File.Requirements).Distinct().ToList(); foreach (var lines in CreateDockerRequirements(requirements, platform)) { - yield return lines; + yield return $"\t {lines}"; } foreach (var dependencies in CreateSnapshotDependencies(buildBuildTypes, null)) { - yield return dependencies; + yield return $"\t{dependencies}"; + } + + yield return "})"; + yield return string.Empty; + } + + + /// + /// Generates Kotlin DSL file with build configuration for post-push Docker image check. + /// A post-push validation build had been done for the purpose of lower cost for failure within build chain. + /// + /// Identifier the the creating build configuration. + /// Images that will be checked in context of build configuration. + /// (might be empty) postfix to image repository name, e.g.: "-staging" + private IEnumerable CreateImageValidationConfig(string buildTypeId, IEnumerable allImages, string imagePostfix) { + + + yield return $"object {buildTypeId}: BuildType(" + "{"; + yield return "\t name = \"Validation of Size Regression - Staging Docker Images (Windows / Linux)\""; + yield return $"\t {_buildNumberPattern}"; + + // VCS Root Is needed in order to launch automaiton framework + yield return String.Join('\n', + "\t vcs {", + "\t\t root(TeamCityDockerImagesRepo)", + "\t }" + ); + + // Trigger is needed to execute the image once they've been published into Dockerhub + yield return String.Join('\n', + "\n\t triggers {", + "\t\t // Execute the build once the images are available within %deployRepository%", + "\t\t finishBuildTrigger {", + "\t\t\t buildType = \"${PublishHubVersion.publish_hub_version.id}\"", + "\t\t }", + "\t }" + ); + + // Parameters are needed in order to prevent unnecessarry dependency from an inherited parameter + yield return String.Join('\n', + "\n\t params {", + "\t\t // -- inherited parameter, removed in debug purposes", + "\t\t param(\"dockerImage.teamcity.buildNumber\", \"-\")", + "\t }" + ); + + + // -- Declare a set of images that we'd need to iterate over + // -- containing elements for Kotlin hashmap declaration: ... + // -- ... - + List validationHashmapEntries = new List(); + + foreach (var image in allImages) { + var newRepo = $"{DeployRepositoryName}{image.File.ImageId}{imagePostfix}"; + var newRepoTag = $"{newRepo}:{image.File.Tags.First()}"; + // Add as as Kotlin DSL list element + // -- hashmap: , + validationHashmapEntries.Add($"\"{image.File.ImageId}-{image.File.Tags.First()}\" to \"{newRepoTag}\""); } + // -- Create declaration of HashMap within DSL which will be used for generation of step "{ ... }" blocks + yield return String.Join('\n', + "\n\t val targetImages: HashMap = hashMapOf(", + // concatenate previously created hashmap entries for the declaration within DSL + String.Join(", \n\t\t", validationHashmapEntries), + "\t )" + ); + + // Generate steps in order to validate the images within the list above + yield return String.Join('\n', + "\n\t steps {", + "\t\t targetImages.forEach { (imageVerificationStepId, imageDomainName) ->", + "\t\t // Generate validation for each image fully-qualified domain name (FQDN)", + "\t\t gradle {", + "\t\t\t name = \"Image Verification - $imageVerificationStepId\"", + // "%docker.buildRepository.login% %docker.stagingRepository.token%" are defined within TeamCity server + "\t\t\t tasks = \"clean build run --args=\\\"validate $imageDomainName %docker.stagingRepository.login% %docker.stagingRepository.token%\\\"\"", + "\t\t\t workingDir = \"tool/automation/framework\"", + "\t\t\t buildFile = \"build.gradle\"", + "\t\t\t jdkHome = \"%env.JDK_11_x64%\"", + "\t\t\t executionMode = BuildStep.ExecutionMode.ALWAYS", + "\t\t\t }", + "\t\t }", + "\t }" + ); + + // Generate failure conditions + yield return String.Join('\n', + "\n\t failureConditions {", + "\t\t // Failed in case the validation via framework didn't succeed", + "\t\t failOnText {", + "\t\t\t conditionType = BuildFailureOnText.ConditionType.CONTAINS", + "\t\t\t pattern = \"DockerImageValidationException\"", + "\t\t\t failureMessage = \"Docker Image validation have failed\"", + "\t\t\t // allows the steps to continue running even in case of one problem", + "\t\t\t reportOnlyFirstMatch = false", + "\t\t }", + "\t }" + ); + + // Generate requirements + yield return String.Join('\n', + "\n\t requirements {", + "\t\t exists(\"env.JDK_11\")", + "\t\t // Images are validated mostly via DockerHub REST API. In case ...", + "\t\t // ... Docker agent will be used, platform-compatibility must be addressed, ...", + "\t\t // ... especially in case of Windows images.", + "\t\t contains(\"teamcity.agent.jvm.os.name\", \"Linux\")", + "\t }" + ); + + // Generate build features + yield return String.Join('\n', + "\n\t features {", + "\t\t dockerSupport {", + "\t\t\t cleanupPushedImages = true", + "\t\t\t loginToRegistry = on {", + "\t\t\t dockerRegistryId = \"PROJECT_EXT_774\"", + "\t\t\t }", + "\t\t }", + "\t }" + ); + yield return "})"; yield return string.Empty; } + /// + /// Generates TeamCity build configuration (Kotlin DSL) for publishing of Docker image manifests. + /// + /// creating build ID + /// target repository for image publishing + /// build name + /// list of Docker images + /// postfix that should be appended to the tags of all images + /// indicates if the build is being created for staging purposes + /// dependencies of the build (other TeamCity build configuration, if any) private IEnumerable CreateManifestBuildConfiguration(string buildTypeId, string repositoryName, string name, IReadOnlyCollection> images, string imagePostfix, bool? onStaging, params string[] dependencies) - { - yield return $"object {buildTypeId}: BuildType("; - yield return "{"; - yield return $"name = \"{name}\""; - yield return _buildNumberPattern; - yield return "enablePersonalBuilds = false"; - yield return "type = BuildTypeSettings.Type.DEPLOYMENT"; - yield return "maxRunningBuilds = 1"; - - yield return "steps {"; + { + yield return $"object {buildTypeId}: BuildType(" + "{"; + yield return $"\t name = \"{name}\""; + yield return $"\t{_buildNumberPattern}"; + yield return "\t enablePersonalBuilds = false"; + yield return "\t type = BuildTypeSettings.Type.DEPLOYMENT"; + yield return "\t maxRunningBuilds = 1"; + + yield return "\t steps {"; foreach (var line in AddScript("remove manifests", RemoveManifestsScript)) { - yield return line; + yield return $"\t\t {line}"; } foreach (var group in images.OrderBy(i => i.Key)) @@ -324,30 +503,30 @@ private IEnumerable CreateManifestBuildConfiguration(string buildTypeId, { foreach (var line in CreateManifestCommands(repositoryName, group.Key, groupByImageId.Key, imagePostfix, groupByImageId)) { - yield return line; + yield return $"\t{line}"; } } } - yield return "}"; + yield return "\t }"; foreach (var line in CreateSnapshotDependencies(dependencies, onStaging)) { - yield return line; + yield return $"\t{line}"; } var requirements = images.SelectMany(i => i).SelectMany(i => i.File.Requirements).Distinct().ToList(); foreach (var lines in CreateDockerRequirements(requirements, "windows", MinDockerVersion)) { - yield return lines; + yield return $"\t{lines}"; } - yield return "features {"; + yield return "\t features {"; foreach (var line in CreateDockerFeature()) { - yield return line; + yield return $"\t\t {line}"; } - yield return "}"; + yield return "\t}"; yield return "})"; yield return string.Empty; @@ -358,23 +537,23 @@ private static IEnumerable CreateDockerRequirements(IReadOnlyCollection< yield return "requirements {"; if (!string.IsNullOrWhiteSpace(minDockerVersion)) { - yield return $"noLessThanVer(\"docker.version\", \"{minDockerVersion}\")"; + yield return $"\t noLessThanVer(\"docker.version\", \"{minDockerVersion}\")"; } if (!string.IsNullOrWhiteSpace(platform)) { - yield return $"contains(\"docker.server.osType\", \"{platform}\")"; + yield return $"\t contains(\"docker.server.osType\", \"{platform}\")"; } foreach (var requirement in requirements) { if (string.IsNullOrWhiteSpace(requirement.Value)) { - yield return $"{requirement.Type.ToString().ToLowerInvariant()}(\"{requirement.Property}\")"; + yield return $"\t {requirement.Type.ToString().ToLowerInvariant()}(\"{requirement.Property}\")"; } else { - yield return $"{requirement.Type.ToString().ToLowerInvariant()}(\"{requirement.Property}\", \"{requirement.Value}\")"; + yield return $"\t {requirement.Type.ToString().ToLowerInvariant()}(\"{requirement.Property}\", \"{requirement.Value}\")"; } } yield return "}"; @@ -470,89 +649,97 @@ group image by image.File var pauseStr = onPause ? "ON PAUSE " : ""; yield return $"object {buildTypeId} : BuildType({{"; - yield return $"name = \"{pauseStr}Build and push {name}\""; - yield return _buildNumberPattern; - yield return $"description = \"{description}\""; + yield return $"\t name = \"{pauseStr}Build and push {name}\""; + yield return $"\t {_buildNumberPattern}"; + yield return $"\t description = \"{description}\""; if (!onPause) { - yield return "vcs {root(TeamCityDockerImagesRepo)}"; - yield return "steps {"; + yield return "\t vcs {"; + yield return "\t\t root(TeamCityDockerImagesRepo)"; + yield return "\t }"; - // docker pull + + yield return "\n \t steps {"; + + // "docker pull" command types @ steps { ... } block foreach (var command in references.SelectMany(refer => CreatePullCommand(refer.RepoTag, refer.RepoTag))) { - yield return command; + yield return $"\t\t{command}"; } - // docker build + // "docker build" command types @ steps { ... } block foreach (var command in images.SelectMany(image => CreatePrepareContextCommand(image).Concat(CreateBuildCommand(image)))) { - yield return command; + yield return $"\t\t{command}"; } - // docker image tag + // "docker image tag" command types @ steps { ... } block foreach (var image in images) { if (image.File.Tags.Any()) { var tag = image.File.Tags.First(); + + // "tag" command foreach (var tagCommand in CreateTagCommand($"{image.File.ImageId}:{tag}", $"{BuildRepositoryName}{image.File.ImageId}{BuildImagePostfix}:{tag}", $"{image.File.ImageId}:{tag}")) { - yield return tagCommand; + yield return $"\t\t{tagCommand}"; } } } - // docker push + // "docker push" command types @ steps { ... } block foreach (var image in images) { var tag = image.File.Tags.First(); foreach (var pushCommand in CreatePushCommand($"{BuildRepositoryName}{image.File.ImageId}{BuildImagePostfix}", $"{image.File.ImageId}:{tag}", tag)) { - yield return pushCommand; + yield return $"\t\t{pushCommand}"; } } - yield return "}"; + // end of steps {...} block + yield return "\t}"; - yield return "features {"; + yield return "\tfeatures {"; if (weight > 0) { foreach (var feature in CreateFreeDiskSpaceFeature(weight)) { - yield return feature; + yield return $"\t\t{feature}"; } } foreach (var feature in CreateDockerFeature()) { - yield return feature; + yield return $"\t\t{feature}"; } // ReSharper disable once StringLiteralTypo foreach (var feature in CreateSwabraFeature()) { - yield return feature; + yield return $"\t\t{feature}"; } - yield return "}"; + // end of features { ... } block + yield return "\t}"; foreach (var dependencies in CreateArtifactsDependencies()) { - yield return dependencies; + yield return $"\t{dependencies}"; } foreach (var param in CreateSpaceParams(weight)) { - yield return param; + yield return $"\t{param}"; } var requirements = images.SelectMany(i => i.File.Requirements).Distinct().ToList(); foreach (var lines in CreateDockerRequirements(requirements)) { - yield return lines; + yield return $"\t{lines}"; } } @@ -565,36 +752,40 @@ private static IEnumerable CreateSpaceParams(int weight) if (weight > 0) { yield return "params {"; - yield return $"param(\"system.teamcity.agent.ensure.free.space\", \"{weight}gb\")"; + yield return $"\t param(\"system.teamcity.agent.ensure.free.space\", \"{weight}gb\")"; yield return "}"; } } private IEnumerable CreateSnapshotDependencies(IEnumerable dependencies, bool? onStaging) { - yield return "dependencies {"; + yield return "\t dependencies {"; if (onStaging != null) { - yield return $"snapshot(AbsoluteId(\"{_options.TeamCityBuildConfigurationId}\"))"; + yield return $"\t\t snapshot(AbsoluteId(\"{_options.TeamCityBuildConfigurationId}\"))" + " {\n"; if (onStaging == true) { - yield return "{\nonDependencyFailure = FailureAction.FAIL_TO_START\nreuseBuilds = ReuseBuilds.ANY\nsynchronizeRevisions = false\n}"; + yield return "\t\t\t onDependencyFailure = FailureAction.FAIL_TO_START \n \t\t\t reuseBuilds = ReuseBuilds.ANY \n \t\t\t synchronizeRevisions = false \n \t\t }"; } else { - yield return "{\nreuseBuilds = ReuseBuilds.ANY\nonDependencyFailure = FailureAction.IGNORE\n}"; + yield return "\t\t\t reuseBuilds = ReuseBuilds.ANY \n \t\t\t onDependencyFailure = FailureAction.IGNORE \n\t }"; } } foreach (var buildTypeId in dependencies.OrderBy(i => i)) { - yield return $"snapshot({NormalizeFileName(buildTypeId)}.{buildTypeId})"; - yield return "{\nonDependencyFailure = FailureAction.FAIL_TO_START\n}"; + yield return $"\t\t snapshot({NormalizeFileName(buildTypeId)}.{buildTypeId})" + " {\n"; + yield return "\t\t\t onDependencyFailure = FailureAction.FAIL_TO_START \n \t\t }"; } - yield return "}"; + yield return "\t }"; } + /// + /// Generates dependencies {...} block of Kotlin DSL pipeline. Within this scope, ... + /// ... it includes dependencies from builds responsible for the creation of Docker images. + /// private IEnumerable CreateArtifactsDependencies() { if(string.IsNullOrWhiteSpace(_options.TeamCityBuildConfigurationId)) @@ -603,12 +794,95 @@ private IEnumerable CreateArtifactsDependencies() } yield return "dependencies {"; - yield return $"dependency(AbsoluteId(\"{_options.TeamCityBuildConfigurationId}\")) {{"; - yield return "snapshot { onDependencyFailure = FailureAction.IGNORE\nreuseBuilds = ReuseBuilds.ANY }"; - yield return "artifacts {"; - yield return $"artifactRules = \"TeamCity.zip!/**=>{_pathService.Normalize(_options.ContextPath)}/TeamCity\""; + yield return $"\t dependency(AbsoluteId(\"{_options.TeamCityBuildConfigurationId}\")) {{"; + + yield return "\t\t snapshot {"; + yield return "\t\t\t onDependencyFailure = FailureAction.IGNORE"; + yield return "\t\t\t reuseBuilds = ReuseBuilds.ANY"; + yield return "\t\t }"; + + yield return "\t\t artifacts {"; + yield return $"\t\t\t artifactRules = \"TeamCity.zip!/**=>{_pathService.Normalize(_options.ContextPath)}/TeamCity\""; + yield return "\t\t }"; + yield return "\t }"; yield return "}"; + } + + /// + /// Creates dependencies {...} block for build configuration responsible for post-push ... + /// ... validation of Docker images. + /// IDs of dependant build configuration + /// none + private IEnumerable CreateDockerImageValidationSnapDependencies(string[] dependencyIds) { + + if (dependencyIds == null || dependencyIds.Length == 0) { + // dependency IDs must be specified, otherwise the block wouldn't be useful + yield break; + } + + yield return "dependencies {"; + + foreach (string dependantBuildId in dependencyIds) + { + yield return $"\t dependency(AbsoluteId(\"{dependantBuildId}\")) {{"; + // -- build problem is reported, but not termeinated, as some of the dependencies might successfully ... + // -- ... create images. + yield return "\t\t snapshot { onDependencyFailure = FailureAction.ADD_PROBLEM }"; + // dependency {...} + yield return "\t }"; + } + + // dependencies {...} yield return "}"; + } + + /// + /// Creates failure conditions that terminated the build if an error message with given pattern had occurred. + /// + /// Error pattern. + /// Indicates if the steps must continue execution even if after failure. + /// + private IEnumerable CreateFailureConditionRegExpPattern(string pattern, bool reportOnlyFirstMatch = false) { + if (pattern == null) { + yield break; + } + + yield return "failureConditions {"; + + yield return "\t failOnText {"; + yield return $"\t\t conditionType = {TeamCityConstants.Conditions.REGEXP}"; + yield return $"\t\t pattern = \"{pattern}\""; + yield return "\t\t // allows the steps to continue running even in case of one problem"; + yield return $"\t\t reportOnlyFirstMatch = {reportOnlyFirstMatch.ToString().ToLower()}"; + // end of "failOnText{...} + yield return "\t }"; + + // end of failureConditions {...} + yield return "}"; + } + + /// + /// Create build configuration trigger dependant on finished build. + /// + /// target build ID + /// indicates if enclosure (${...}) should be used for build ID + /// + private IEnumerable CreateFinishBuildTrigger(string id, Boolean useEnclosureForId = false) { + if (id == null || id.Length == 0) { + yield break; + } + + yield return "triggers {"; + + yield return "\t finishBuildTrigger {"; + // -- not setting "ID" - that'd be auto-generated + var buildId = useEnclosureForId ? ("${" + $"{id}" + "}") : id; + yield return $"\t\t buildType = \"{buildId}\""; + + // closing 'finishBuildTrigger {...}' + yield return "\t }"; + + // closing triggers {...} yield return "}"; } @@ -617,7 +891,7 @@ private static IEnumerable CreateSwabraFeature() { // ReSharper disable once StringLiteralTypo yield return "swabra {"; - yield return "forceCleanCheckout = true"; + yield return "\t forceCleanCheckout = true"; yield return "}"; } @@ -629,28 +903,34 @@ private IEnumerable CreateDockerFeature() } yield return "dockerSupport {"; - yield return "cleanupPushedImages = true"; - yield return "loginToRegistry = on {"; - yield return $"dockerRegistryId = \"{_options.TeamCityDockerRegistryId}\""; - yield return "}"; + yield return "\t cleanupPushedImages = true"; + yield return "\t loginToRegistry = on {"; + yield return $"\t\t dockerRegistryId = \"{_options.TeamCityDockerRegistryId}\""; + yield return "\t }"; yield return "}"; } private static IEnumerable CreateFreeDiskSpaceFeature(int weight) { yield return "freeDiskSpace {"; - yield return $"requiredSpace = \"{weight}gb\""; - yield return "failBuild = true"; + yield return $"\t requiredSpace = \"{weight}gb\""; + yield return "\t failBuild = true"; yield return "}"; } + /// + /// Constructs Kotlin DSL's dockerCommand {...} for image push. + /// + /// Docker image ID + /// step name + /// target Docker image tags private IEnumerable CreatePushCommand(string imageId, string name, params string[] tags) { yield return "dockerCommand {"; - yield return $"name = \"push {name}\""; - yield return "commandType = push {"; + yield return $"\t name = \"push {name}\""; + yield return "\t commandType = push {"; - yield return "namesAndTags = \"\"\""; + yield return "\t\t namesAndTags = \"\"\""; foreach (var tag in tags) { yield return $"{imageId}:{tag}"; @@ -658,35 +938,46 @@ private IEnumerable CreatePushCommand(string imageId, string name, param yield return "\"\"\".trimIndent()"; - yield return "removeImageAfterPush = false"; + yield return "\t\t removeImageAfterPush = false"; - yield return "}"; + yield return "\t }"; yield return "}"; yield return string.Empty; } + /// + /// Constructs Kotlin DSL's dockerCommand {...} for image re-tag. + /// + /// original Docker image tag + /// target Docker image tag + /// step name private IEnumerable CreateTagCommand(string repoTag, string newRepoTag, string name) { yield return "dockerCommand {"; - yield return $"name = \"tag {name}\""; - yield return "commandType = other {"; + yield return $"\t name = \"tag {name}\""; + yield return "\t commandType = other {"; - yield return "subCommand = \"tag\""; - yield return $"commandArgs = \"{repoTag} {newRepoTag}\""; + yield return "\t\t subCommand = \"tag\""; + yield return $"\t\t commandArgs = \"{repoTag} {newRepoTag}\""; - yield return "}"; + yield return "\t}"; yield return "}"; yield return string.Empty; } + /// + /// Constructs Kotlin DSL's step for preparation to dockerCommand {...}, such as ... + /// ... the creation of .dockerignore, append of the entries into it. + /// + /// info about Docker image private IEnumerable CreatePrepareContextCommand(Image image) { var tag = image.File.Tags.First(); yield return "script {"; - yield return $"name = \"context {image.File.ImageId}:{tag}\""; - yield return "scriptContent = \"\"\""; + yield return $"\t name = \"context {image.File.ImageId}:{tag}\""; + yield return "\t scriptContent = \"\"\""; // ReSharper disable once IdentifierTypo // ReSharper disable once StringLiteralTypo @@ -703,21 +994,25 @@ private IEnumerable CreatePrepareContextCommand(Image image) yield return string.Empty; } + /// + /// Constructs Kotlin DSL's dockerCommand {...} for image build. + /// + /// info about Docker image private IEnumerable CreateBuildCommand(Image image) { var tag = image.File.Tags.First(); yield return "dockerCommand {"; - yield return $"name = \"build {image.File.ImageId}:{tag}\""; - yield return "commandType = build {"; + yield return $"\t name = \"build {image.File.ImageId}:{tag}\""; + yield return "\t commandType = build {"; - yield return "source = file {"; - yield return $"path = \"\"\"{_pathService.Normalize(Path.Combine(_options.TargetPath, image.File.Path, "Dockerfile"))}\"\"\""; - yield return "}"; + yield return "\t\t source = file {"; + yield return $"\t\t\t path = \"\"\"{_pathService.Normalize(Path.Combine(_options.TargetPath, image.File.Path, "Dockerfile"))}\"\"\""; + yield return "\t\t }"; - yield return $"contextDir = \"{_pathService.Normalize(_options.ContextPath)}\""; - yield return "commandArgs = \"--no-cache\""; + yield return $"\t contextDir = \"{_pathService.Normalize(_options.ContextPath)}\""; + yield return "\t commandArgs = \"--no-cache\""; - yield return "namesAndTags = \"\"\""; + yield return "\t namesAndTags = \"\"\""; yield return $"{image.File.ImageId}:{tag}"; yield return "\"\"\".trimIndent()"; @@ -728,16 +1023,21 @@ private IEnumerable CreateBuildCommand(Image image) yield return string.Empty; } + /// + /// Constructs Kotlin DSL's dockerCommand {...} for Docker Image pull. + /// + /// image's registry + /// image's tag private static IEnumerable CreatePullCommand(string repoTag, string name) { yield return "dockerCommand {"; - yield return $"name = \"pull {name}\""; - yield return "commandType = other {"; + yield return $"\t name = \"pull {name}\""; + yield return "\t commandType = other {"; - yield return "subCommand = \"pull\""; - yield return $"commandArgs = \"{repoTag}\""; + yield return $"\t\t subCommand = \"pull\""; + yield return $"\t\t commandArgs = \"{repoTag}\""; - yield return "}"; + yield return "\t }"; yield return "}"; yield return string.Empty; @@ -746,11 +1046,11 @@ private static IEnumerable CreatePullCommand(string repoTag, string name private IEnumerable CreateDockerCommand(string name, string command, IEnumerable args) { yield return "dockerCommand {"; - yield return $"name = \"{name}\""; - yield return "commandType = other {"; - yield return $"subCommand = \"{command}\""; - yield return $"commandArgs = \"{string.Join(" ", args)}\""; - yield return "}"; + yield return $"\t name = \"{name}\""; + yield return "\t commandType = other {"; + yield return $"\t\t subCommand = \"{command}\""; + yield return $"\t\t commandArgs = \"{string.Join(" ", args)}\""; + yield return "\t }"; yield return "}"; } @@ -764,8 +1064,8 @@ private static string NormalizeName(string name) => private static IEnumerable AddScript(string name, string script) { yield return "script {"; - yield return $"name = \"{name}\""; - yield return $"scriptContent = \"{script}\""; + yield return $"\t name = \"{name}\""; + yield return $"\t scriptContent = \"{script}\""; yield return "}"; } } diff --git a/tool/automation/ImageValidation.main.kts b/tool/automation/ImageValidation.main.kts deleted file mode 100644 index ad349f31b..000000000 --- a/tool/automation/ImageValidation.main.kts +++ /dev/null @@ -1,264 +0,0 @@ -import java.lang.Exception -import java.lang.System -import java.util.concurrent.TimeUnit - -/** - * Target values used for validation purposes. - */ -object ValidationConstants { - const val ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT = 5.0f -} - -/** - * Mark-up exception class for failed validation of Docker images. - */ -class DockerImageValidationException(message: String) : Exception(message) - - -/** - * Executes command. - * @param command - command to be execution - * @param redirectStderr - indicates if error output must be captured along with ... - * ... stdout - * @return result of command's execution ; null in case of exception - */ -fun executeCommand(command: String, redirectStderr: Boolean = true, timeoutSec: Long = 60): String? { - return runCatching { - // -- converting command to list containing the arguments - val args = command.split(Regex("(?.-". - */ -fun getPrevDockerImageId(imageId: String): String? { - val curImageTag = imageId.split(":")[1] - val curImageTagElems = curImageTag.split(".") - - if (curImageTagElems.size < 2) { - // image is highly likely doesn't correspond to pattern - throw IllegalArgumentException("Unable to auto-determine previous image tag - it doesn't correspond to pattern: $imageId") - } - - // handling 2 types: 2022.04-OS and 2022.04.2-OS - val isMinorRelease = curImageTagElems.size > 2 - - if (!isMinorRelease) { - System.err.println("Automatic determination of previous release is supported only for minor version of TeamCity.") - return null - } - - val imageBuildNum = curImageTagElems[2].split("-")[0] - - // -- construct old image tag based on retrieved information from the current one - // -- -- adding "0" since build number has at least 2 digits - val oldBuildNumber = Integer.parseInt(imageBuildNum) - 1 - - // Replace current image's numeric part of tag with determined "old" value, e.g. "2022.04.2-" -> "2022.04.1-" - val originalImageTagPart = (curImageTagElems[0] + "." + curImageTagElems[1] + "." + imageBuildNum + "-") - val determinedOldImageTagPart = (curImageTagElems[0] + "." + curImageTagElems[1] + "." + oldBuildNumber + "-") - val oldImageId = imageId.replace(originalImageTagPart, determinedOldImageTagPart) - return oldImageId -} - - -/** - * Tries to pull Docker image from registry. - * @param name - docker image fully-qualified domain name - * @return true if image had been successfully pulled, false otherwise - */ -fun pullDockerImage(name: String): Boolean { - val cmdResult = this.executeCommand("docker pull $name", true) ?: "" - println("Pulling $name ... \n $cmdResult") - // using success messages since some errors from docker daemon (e.g. invalid platform type) are not ... - // ... captured by Kotlin's ProcessBuilder. - val successMessages = arrayOf("Pull complete", "Image is up to date", "Downloaded newer", "Download complete") - return successMessages.any { cmdResult.contains(it, ignoreCase = true) } -} - -/** - * Pulls Docker image with certain amount of retries. Purpose: handle potential communication issues with ... - * ... Docker agent. - * @param name - Docker Image fully-qualified domain name - * @param retryCount - amount of total attempts to pull the image - * @param delayMillis - delay between attempts - */ -fun pullDockerImageWithRetry(name: String, retryCount: Int, delayMillis: Long = 1000): Boolean { - var pullSucceeded = false - var attempts = retryCount - while (attempts > 0) { - pullSucceeded = this.pullDockerImage(name) - if (pullSucceeded) { - break - } - attempts-- - Thread.sleep(delayMillis) - } - return pullSucceeded -} - -/** - * Returns image ID for statistics within TeamCity. ID consists of image name with removed repository and release. - * Example: "some-registry.example.io/teamcity-agent:2022.10-windowsservercore-1809" -> "teamcity-agent-windowsservercore-1809" - * Purpose: let it be possible to compare different images regardless of the release. - * @param image - Docker image FQDN; - * @return ID of an image for TeamCity statistics - */ -fun getImageStatisticsId(image: String): String { - // 1. Remove registry - val imageRegistryElements = image.split('/') - val imageNameNoRegistry = imageRegistryElements[imageRegistryElements.size - 1] - - // 2. Remove release from tag - val imageTagElements = imageNameNoRegistry.split(':')[1].split('-') - // remove tag - return imageNameNoRegistry.replace("${imageTagElements[0]}-", "") - -} - - -/** - * Validates Docker image size. - * Criteria: it shouldn't increase by more than threshold (@see ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT). - * @param currentName - name of original Docker image - * @param previousName - name of previous Docker image - * @return true if image size increase suppressed given threshold; false otherwise (including situation when ... - * ... it wasn't possible to determine any of image sizes) - */ -fun imageSizeChangeSuppressesThreshold(currentName: String, previousName: String?, threshold: Float): Boolean { - // -- get size of current image - val curSize = this.getDockerImageSize(currentName) - if (curSize == null) { - System.err.println("Image does not exist on the agent: $currentName") - return false - } - - // -- report image size to TeamCity - this.reportTeamCityStatistics("SIZE-${this.getImageStatisticsId(currentName)}", curSize) - - if (previousName.isNullOrBlank()) { - return false - } - - // -- get size of previous image - val prevImagePullSucceeded = this.pullDockerImageWithRetry(previousName, 2) - val prevSize = this.getDockerImageSize(previousName) - if (!prevImagePullSucceeded || prevSize == null) { - System.err.println("Unable to get size of previous image: $previousName") - return false - } - - // -- calculates image increase & notify if exceeds threshold - val percentageIncrease = this.getPercentageIncrease(curSize, prevSize) - return (percentageIncrease > threshold) -} - -/** - * Reports statistics to TeamCity via Service Messages. - * @param key metric ID - * @param value metricValue - * - * TODO: Think about generic 'value' type - */ -fun reportTeamCityStatistics(key: String, value: Long) { - println("##teamcity[buildStatisticValue key='$key' value='$value']") -} - -fun main(args: Array) { - - if (args.isEmpty()) { - throw IllegalArgumentException("Not enough CLI arguments.") - } - val imageName = args[0] - - val prevImageName = if (args.size >= 2) { - // -- take image name - args[1] - } else { - // -- previous image name was not explicitly specified => try to determine automatically )by pattern) - try { - this.getPrevDockerImageId(imageName) - } catch (ex: IndexOutOfBoundsException) { - throw IllegalArgumentException("Unable to determine previous image tag from given ID: $imageName \n" + - "Expected image name pattern: \".-\"") - } - } - - val imageSizeChangeSuppressesThreshold = this.imageSizeChangeSuppressesThreshold(imageName, - prevImageName, - ValidationConstants.ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT) - if (imageSizeChangeSuppressesThreshold) { - throw DockerImageValidationException("Image $imageName size compared to previous ($prevImageName) " + - "suppresses ${ValidationConstants.ALLOWED_IMAGE_SIZE_INCREASE_THRESHOLD_PERCENT}% threshold.") - } -} - -main(args) diff --git a/tool/automation/framework/README.md b/tool/automation/framework/README.md new file mode 100644 index 000000000..417d3cc4d --- /dev/null +++ b/tool/automation/framework/README.md @@ -0,0 +1,45 @@ +# Automation Utilities + +## 1. Purpose +Automation Framework that simplifies release process of Docker Images. + +## 2. Build +The application could be built using Gradle Wrapper. +``` +./gradlew clean build +``` + + +## 3. Execution + +``` +./gradlew