diff --git a/.teamcity/common/TeamCityDockerImagesRepo.kts b/.teamcity/common/TeamCityDockerImagesRepo.kts deleted file mode 100644 index 939f29a94..000000000 --- a/.teamcity/common/TeamCityDockerImagesRepo.kts +++ /dev/null @@ -1,9 +0,0 @@ -package common - -import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot - -object TeamCityDockerImagesRepo : GitVcsRoot({ - name = "TeamCity Docker Images" - url = "https://github.com/JetBrains/teamcity-docker-images.git" - branch = "refs/heads/%teamcity.branch%" -}) diff --git a/.teamcity/common/TeamCityDockerImagesRepo_AllBranches.kt b/.teamcity/common/TeamCityDockerImagesRepo_AllBranches.kt deleted file mode 100644 index 23d90d3f7..000000000 --- a/.teamcity/common/TeamCityDockerImagesRepo_AllBranches.kt +++ /dev/null @@ -1,14 +0,0 @@ -package common - -import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot - -/** - * teamcity-docker-images that allow execution from each branch. The use must be limited to development ... - * ... configurations only. - */ -object TeamCityDockerImagesRepo_AllBranches: GitVcsRoot({ - name = "TeamCity Docker Images - All Branches" - url = "https://github.com/JetBrains/teamcity-docker-images.git" - branchSpec = "+:refs/heads/*" - branch = "refs/heads/%teamcity.branch%" -}) \ No newline at end of file diff --git a/.teamcity/delivery/HubProject.kts b/.teamcity/delivery/HubProject.kts deleted file mode 100644 index ccccd1e0b..000000000 --- a/.teamcity/delivery/HubProject.kts +++ /dev/null @@ -1,16 +0,0 @@ -package delivery - -import delivery.arm.PushProductionLinux2004_Aarch64 -import delivery.production.PushHubLinux -import delivery.production.PushHubWindows -import delivery.production.manifest.PublishHubVersion -import jetbrains.buildServer.configs.kotlin.v2019_2.Project - -object HubProject : Project({ - name = "TeamCity Docker Images Deployment into Production Registry" - description = "Configurations designed the promotion of TeamCity Docker Images from staging to production registry." - buildType(PushHubLinux.push_hub_linux) - buildType(PushHubWindows.push_hub_windows) - buildType(PublishHubVersion.publish_hub_version) - buildType(PushProductionLinux2004_Aarch64.push_production_linux_2004_aarch64) -}) diff --git a/.teamcity/delivery/ImageValidation.kts b/.teamcity/delivery/ImageValidation.kts deleted file mode 100644 index c32f485ff..000000000 --- a/.teamcity/delivery/ImageValidation.kts +++ /dev/null @@ -1,95 +0,0 @@ -package delivery - -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo -import delivery.production.manifest.PublishHubVersion -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.general.teamCityStagingImagesSnapshot -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildStep -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle -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.triggers.finishBuildTrigger - -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}" - // if filter won't be specified, only branch would be included - branchFilter = """ - +:development/* - +:release/* - """.trimIndent() - } - } - - params { - // -- inherited parameter, removed in debug purposes - param("dockerImage.teamcity.buildNumber", "-") - } - - val targetImages: HashMap = hashMapOf( - "teamcity-server-%tc.image.version%-linux" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:%tc.image.version%-linux", - "teamcity-agent-%tc.image.version%-linux" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-linux", - "teamcity-agent-%tc.image.version%-linux-sudo" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-linux-sudo", - "teamcity-minimal-agent-%tc.image.version%-linux" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:%tc.image.version%-linux", - "teamcity-server-%tc.image.version%-nanoserver-1809" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:%tc.image.version%-nanoserver-1809", - "teamcity-agent-%tc.image.version%-windowsservercore-1809" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-windowsservercore-1809", - "teamcity-agent-%tc.image.version%-nanoserver-1809" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-nanoserver-1809", - "teamcity-minimal-agent-%tc.image.version%-nanoserver-1809" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:%tc.image.version%-nanoserver-1809", - "teamcity-server-%tc.image.version%-nanoserver-2004" to "%docker.deployRepository%teamcity-server%docker.buildImagePostfix%:%tc.image.version%-nanoserver-2004", - "teamcity-agent-%tc.image.version%-windowsservercore-2004" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-windowsservercore-2004", - "teamcity-agent-%tc.image.version%-nanoserver-2004" to "%docker.deployRepository%teamcity-agent%docker.buildImagePostfix%:%tc.image.version%-nanoserver-2004", - "teamcity-minimal-agent-%tc.image.version%-nanoserver-2004" to "%docker.deployRepository%teamcity-minimal-agent%docker.buildImagePostfix%:%tc.image.version%-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 { - teamCityImageBuildFeatures() - } - - dependencies { - // Dependency on the build of the Docker image - teamCityStagingImagesSnapshot() - } -}) diff --git a/.teamcity/delivery/LocalProject.kts b/.teamcity/delivery/LocalProject.kts deleted file mode 100644 index c87d389e2..000000000 --- a/.teamcity/delivery/LocalProject.kts +++ /dev/null @@ -1,30 +0,0 @@ -package delivery - -import delivery.inactive.PushLocalLinux1804 -import delivery.inactive.PushLocalWindows1803 -import delivery.inactive.PushLocalWindows1903 -import delivery.inactive.PushLocalWindows1909 -import delivery.staging.PushLocalLinux2004 -import delivery.staging.PushLocalWindows1809 -import delivery.staging.PushLocalWindows2004 -import delivery.staging.manifest.PublishLocal -import delivery.arm.PushStagingLinux2004_Aarch64 -import jetbrains.buildServer.configs.kotlin.v2019_2.Project - -object LocalProject : Project({ - name = "TeamCity Docker Images Deployment into Staging Registry" - description = "Configurations designed for the build of TeamCity Docker Images and their publishing into 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) - - // aarch64 (ARM) images - buildType(PushStagingLinux2004_Aarch64.push_staging_linux_2004_aarch64) -}) diff --git a/.teamcity/delivery/arm/PushProductionLinux2004_Aarch64.kts b/.teamcity/delivery/arm/PushProductionLinux2004_Aarch64.kts deleted file mode 100644 index 15a736b27..000000000 --- a/.teamcity/delivery/arm/PushProductionLinux2004_Aarch64.kts +++ /dev/null @@ -1,39 +0,0 @@ -package delivery.arm - -import common.TeamCityDockerImagesRepo -import utils.ImageInfoRepository -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.moveToProduction -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -/** - * Deploy aarch64 (ARM) TeamCity Docker images into production registry. - */ -object push_production_linux_2004_aarch64 : BuildType({ - name = "[aarch64] [Linux 2004] Build and deploy production images" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Publish Linux-based Docker images for aarch64 platform." - vcs { - root(TeamCityDockerImagesRepo.TeamCityDockerImagesRepo) - } - - steps { - ImageInfoRepository.getArmLinuxImages2004().forEach { imageInfo -> - moveToProduction(imageInfo) - } - } - - features { - teamCityImageBuildFeatures(useCleanup = false) - } - - dependencies { - teamCityBuildDistDocker() - } - - requirements { - // must be built on aarch64-based agents - contains("teamcity.agent.name", "arm") - } -}) diff --git a/.teamcity/delivery/arm/PushStagingLinux2004_Aarch64.kts b/.teamcity/delivery/arm/PushStagingLinux2004_Aarch64.kts deleted file mode 100644 index e50d29d35..000000000 --- a/.teamcity/delivery/arm/PushStagingLinux2004_Aarch64.kts +++ /dev/null @@ -1,66 +0,0 @@ -package delivery.arm - -import common.TeamCityDockerImagesRepo -import utils.ImageInfoRepository -import utils.dsl.steps.buildAndPushToStaging -import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction -import jetbrains.buildServer.configs.kotlin.v2019_2.ReuseBuilds -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.buildSteps.dockerCommand -import utils.config.DeliveryConfig -import utils.dsl.general.teamCityImageBuildFeatures - -/** - * Building and deploying aarch64 (ARM) Linux-based Docker images into staging registry, which is defined ... - * ... within upstream's parameters. - */ -object push_staging_linux_2004_aarch64 : BuildType({ - name = "[aarch64] [Linux 2004] Build and deploy staging images" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Build and deploy Linux-based Docker images for aarch64 platform." - vcs { - root(TeamCityDockerImagesRepo.TeamCityDockerImagesRepo) - } - - steps { - dockerCommand { - name = "pull ubuntu:20.04" - commandType = other { - subCommand = "pull" - commandArgs = "ubuntu:20.04" - } - } - - ImageInfoRepository.getArmLinuxImages2004().forEach { imageInfo -> - buildAndPushToStaging(imageInfo) - } - } - - features { - teamCityImageBuildFeatures(requiredSpaceGb = 8) - } - - dependencies { - dependency(AbsoluteId(DeliveryConfig.buildDistDockerDepId)) { - snapshot { - onDependencyFailure = FailureAction.IGNORE - reuseBuilds = ReuseBuilds.ANY - } - artifacts { - artifactRules = "TeamCity.zip!/**=>context/TeamCity" - } - } - } - params { - param("system.teamcity.agent.ensure.free.space", "8gb") - } - - requirements { - // must be built on aarch64-based agents - contains("teamcity.agent.name", "arm") - } -}) diff --git a/.teamcity/delivery/inactive/PushLocalLinux1804.kts b/.teamcity/delivery/inactive/PushLocalLinux1804.kts deleted file mode 100644 index cdc28a7c0..000000000 --- a/.teamcity/delivery/inactive/PushLocalLinux1804.kts +++ /dev/null @@ -1,10 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -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" -}) diff --git a/.teamcity/delivery/inactive/PushLocalLinux2004Dotnet.kts b/.teamcity/delivery/inactive/PushLocalLinux2004Dotnet.kts deleted file mode 100644 index 19e421d59..000000000 --- a/.teamcity/delivery/inactive/PushLocalLinux2004Dotnet.kts +++ /dev/null @@ -1,9 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -object push_local_linux_20_04_dotnet : BuildType({ - name = "ON PAUSE Build and push linux 20.04-dotnet" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "teamcity-agent:linux-dotnet" -}) diff --git a/.teamcity/delivery/inactive/PushLocalLinux54.kts b/.teamcity/delivery/inactive/PushLocalLinux54.kts deleted file mode 100644 index 362daefa4..000000000 --- a/.teamcity/delivery/inactive/PushLocalLinux54.kts +++ /dev/null @@ -1,9 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -object push_local_linux_5_4 : BuildType({ - name = "ON PAUSE Build and push linux 5.4" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "teamcity-minimal-agent:EAP-linux-raspbian5.4,EAP" -}) diff --git a/.teamcity/delivery/inactive/PushLocalWindows1803.kts b/.teamcity/delivery/inactive/PushLocalWindows1803.kts deleted file mode 100644 index fed4b2d55..000000000 --- a/.teamcity/delivery/inactive/PushLocalWindows1803.kts +++ /dev/null @@ -1,10 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -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" -}) diff --git a/.teamcity/delivery/inactive/PushLocalWindows1809Dotnet.kts b/.teamcity/delivery/inactive/PushLocalWindows1809Dotnet.kts deleted file mode 100644 index d11fcff66..000000000 --- a/.teamcity/delivery/inactive/PushLocalWindows1809Dotnet.kts +++ /dev/null @@ -1,9 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -object push_local_windows_1809_dotnet : BuildType({ - name = "ON PAUSE Build and push windows 1809-dotnet" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "teamcity-agent:nanoserver-dotnet" -}) diff --git a/.teamcity/delivery/inactive/PushLocalWindows1903.kts b/.teamcity/delivery/inactive/PushLocalWindows1903.kts deleted file mode 100644 index bc095b189..000000000 --- a/.teamcity/delivery/inactive/PushLocalWindows1903.kts +++ /dev/null @@ -1,10 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -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" -}) diff --git a/.teamcity/delivery/inactive/PushLocalWindows1909.kts b/.teamcity/delivery/inactive/PushLocalWindows1909.kts deleted file mode 100644 index 36e276db1..000000000 --- a/.teamcity/delivery/inactive/PushLocalWindows1909.kts +++ /dev/null @@ -1,10 +0,0 @@ -package delivery.inactive - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -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" -}) diff --git a/.teamcity/delivery/production/PushHubLinux.kts b/.teamcity/delivery/production/PushHubLinux.kts deleted file mode 100644 index 554f20d1a..000000000 --- a/.teamcity/delivery/production/PushHubLinux.kts +++ /dev/null @@ -1,37 +0,0 @@ -package delivery.production - -import utils.ImageInfoRepository -import utils.dsl.general.publishStagingManifests -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.moveToProduction -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -object push_hub_linux : BuildType({ - name = "[Linux] [Production] Release TeamCity Docker Images into Production Registry" - description = "Moves TeamCity Linux-based staging images into production registry." - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - - params { - param("dockerImage.platform", "linux") - } - - steps { - ImageInfoRepository.getAmdLinuxImages2004().forEach { imageInfo -> - moveToProduction(imageInfo) - } - } - - features { - teamCityImageBuildFeatures(requiredSpaceGb = 4, useCleanup = false) - } - - requirements { - contains("docker.server.osType", "linux") - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - } - - dependencies { - publishStagingManifests() - } -}) diff --git a/.teamcity/delivery/production/PushHubWindows.kts b/.teamcity/delivery/production/PushHubWindows.kts deleted file mode 100644 index 79eaf5a31..000000000 --- a/.teamcity/delivery/production/PushHubWindows.kts +++ /dev/null @@ -1,45 +0,0 @@ -package delivery.production - -import utils.ImageInfoRepository -import utils.dsl.general.publishStagingManifests -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.moveToProduction -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType - -object push_hub_windows : BuildType({ - name = "[Windows] [Production] Release TeamCity Docker Images into Production Registry" - description = "Moves TeamCity Windows-based staging images into production registry." - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - - params { - param("dockerImage.platform", "windows") - } - - steps { - // Move Windows 1809-based Docker Images into production registry - ImageInfoRepository.getWindowsImages1809().forEach { imageInfo -> - moveToProduction(imageInfo) - } - - // Move Windows 2004-based Docker Images into production registry - ImageInfoRepository.getWindowsImages2022().forEach { imageInfo -> - moveToProduction(imageInfo) - } - } - - features { - // Windows Images Require more disk space - teamCityImageBuildFeatures(requiredSpaceGb = 52, useCleanup = false) - } - - requirements { - contains("docker.server.osType", "windows") - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - contains("teamcity.agent.jvm.os.name", "Windows 10") - } - - dependencies { - publishStagingManifests() - } -}) diff --git a/.teamcity/delivery/production/manifest/PublishHubLatest.kts b/.teamcity/delivery/production/manifest/PublishHubLatest.kts deleted file mode 100644 index 05f79568c..000000000 --- a/.teamcity/delivery/production/manifest/PublishHubLatest.kts +++ /dev/null @@ -1,49 +0,0 @@ -package delivery.production.manifest - -import utils.ImageInfoRepository -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.general.teamCityProdImagesSnapshot -import utils.dsl.steps.publishManifest -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildTypeSettings -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import jetbrains.buildServer.configs.kotlin.v2019_2.version -import utils.dsl.steps.publishLinuxManifests -import utils.dsl.steps.publishWindowsManifests - -/** - * TODO: Merge with 'publish_hub_version'? - */ -object publish_hub_latest : BuildType({ - name = "[All] [Production] Release Manifests as 'latest' into Production Registry" - description = "Publish Docker Manifests into production registry as 'latest' tag." - 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""" - } - - // 'version' - TeamCity version, e.g. 2023.05.1 - // 'manifestName' - ID of manifest (usually, 'latest') - publishLinuxManifests(name = "latest", repo = "%docker.deployRepository%", postfix = "", version = "%tc.image.version%") - publishWindowsManifests(name = "latest", repo = "%docker.deployRepository%", postfix = "", version = "%tc.image.version%") - } - - dependencies { - teamCityProdImagesSnapshot() - } - - requirements { - noLessThanVer("docker.version", "18.05.0") - contains("docker.server.osType", "windows") - } - - features { - teamCityImageBuildFeatures(useCleanup = false) - } -}) diff --git a/.teamcity/delivery/production/manifest/PublishHubVersion.kts b/.teamcity/delivery/production/manifest/PublishHubVersion.kts deleted file mode 100644 index 3596cfef3..000000000 --- a/.teamcity/delivery/production/manifest/PublishHubVersion.kts +++ /dev/null @@ -1,49 +0,0 @@ -package delivery.production.manifest - -import utils.ImageInfoRepository -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.general.teamCityProdImagesSnapshot -import utils.dsl.steps.publishManifest -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildTypeSettings -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import utils.dsl.steps.publishLinuxManifests -import utils.dsl.steps.publishWindowsManifests - -object publish_hub_version : BuildType({ - name = "[All] [Production] Release Manifests as 'version' into Production Registry" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Publish Docker Manifests into production repository with 'version' tag, e.g. 2023.05.1." - - 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""" - } - - // 'version' - TeamCity version, e.g. 2023.05.1 - // 'manifestName' - ID of manifest (usually, 'latest') - publishLinuxManifests(name = "%tc.image.version%", repo = "%docker.deployRepository%") - publishWindowsManifests(name = "%tc.image.version%", repo = "%docker.deployRepository%") - } - - dependencies { - teamCityProdImagesSnapshot() - } - - requirements { - noLessThanVer("docker.version", "18.05.0") - contains("docker.server.osType", "windows") - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - contains("teamcity.agent.jvm.os.name", "Windows 10") - } - - features { - teamCityImageBuildFeatures(useCleanup = false) - } -}) diff --git a/.teamcity/delivery/staging/PushLocalLinux2004.kts b/.teamcity/delivery/staging/PushLocalLinux2004.kts deleted file mode 100644 index 9c6d12a16..000000000 --- a/.teamcity/delivery/staging/PushLocalLinux2004.kts +++ /dev/null @@ -1,51 +0,0 @@ -package delivery.staging - -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo -import utils.ImageInfoRepository -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.buildAndPushToStaging -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand - -object push_local_linux_20_04 : BuildType({ - name = "[Ubuntu 20.04] [Staging] Build And Push TeamCity Docker Images " - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Build Linux 2004-based TeamCity Docker images and pushes them into staging registry.\n" + - "Target images: teamcity-server, minimal agent, regular agent, linux-sudo agent." - vcs { - root(TeamCityDockerImagesRepo) - } - - params { - param("dockerImage.platform", "linux") - } - - steps { - dockerCommand { - name = "Preflight check of base image - ubuntu:20.04" - commandType = other { - subCommand = "pull" - commandArgs = "ubuntu:20.04" - } - } - - ImageInfoRepository.getAmdLinuxImages2004().forEach { imageInfo -> - buildAndPushToStaging(imageInfo) - } - } - - features { - teamCityImageBuildFeatures(requiredSpaceGb = 8) - } - - dependencies { - teamCityBuildDistDocker() - } - - requirements { - contains("docker.server.osType", "linux") - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - } -}) diff --git a/.teamcity/delivery/staging/PushLocalWindows1809.kts b/.teamcity/delivery/staging/PushLocalWindows1809.kts deleted file mode 100644 index 85a4ddd7c..000000000 --- a/.teamcity/delivery/staging/PushLocalWindows1809.kts +++ /dev/null @@ -1,69 +0,0 @@ -package delivery.staging - -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo -import utils.ImageInfoRepository -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.buildAndPushToStaging -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand - -object push_local_windows_1809 : BuildType({ - name = "[Windows 1809] [Staging] Build And Push TeamCity Docker Images" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Build Windows 1809-based TeamCity Docker images and pushes them into staging registry.\n" + - "Target images: teamcity-server (NanoServer 1809), minimal agent (NanoServer 1809), " + - "regular agent (NanoServer 1809, WindowsServer Core 1809)." - vcs { - root(TeamCityDockerImagesRepo) - } - - params { - param("dockerImage.platform", "windows") - } - - 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" - } - } - - ImageInfoRepository.getWindowsImages1809().forEach { imageInfo -> - buildAndPushToStaging(imageInfo) - } - } - - features { - // Windows-based images require more available disk space - teamCityImageBuildFeatures(requiredSpaceGb = 43) - } - - dependencies { - teamCityBuildDistDocker() - } - - requirements { - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - contains("teamcity.agent.jvm.os.name", "Windows 10") - } -}) diff --git a/.teamcity/delivery/staging/PushLocalWindows2004.kts b/.teamcity/delivery/staging/PushLocalWindows2004.kts deleted file mode 100644 index d183edd3c..000000000 --- a/.teamcity/delivery/staging/PushLocalWindows2004.kts +++ /dev/null @@ -1,70 +0,0 @@ -package delivery.staging - -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo -import utils.ImageInfoRepository -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.buildAndPushToStaging -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand - -object push_local_windows_2004 : BuildType({ - name = "[Windows 2004] [Staging] Build And Push TeamCity Docker Images" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Build Windows 2022-based TeamCity Docker images and pushes them into staging registry.\n" + - "Target images: teamcity-server (NanoServer LTSC 2022), minimal agent (NanoServer LTSC 2022), " + - "regular agent (NanoServer LTSC 2022, WindowsServer Core LTSC 2022)." - - vcs { - root(TeamCityDockerImagesRepo) - } - - params { - param("dockerImage.platform", "windows") - } - - steps { - dockerCommand { - name = "pull mcr.microsoft.com/powershell:nanoserver-ltsc2022" - commandType = other { - subCommand = "pull" - commandArgs = "mcr.microsoft.com/powershell:nanoserver-ltsc2022" - } - } - - dockerCommand { - name = "pull mcr.microsoft.com/windows/nanoserver:ltsc2022" - commandType = other { - subCommand = "pull" - commandArgs = "mcr.microsoft.com/windows/nanoserver:ltsc2022" - } - } - - dockerCommand { - name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022" - commandType = other { - subCommand = "pull" - commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022" - } - } - - ImageInfoRepository.getWindowsImages2022().forEach { imageInfo -> - buildAndPushToStaging(imageInfo) - } - } - - features { - // Windows-based images require more available disk space - teamCityImageBuildFeatures(requiredSpaceGb = 43) - } - - dependencies { - teamCityBuildDistDocker() - } - - requirements { - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - contains("teamcity.agent.jvm.os.name", "Windows 10") - } -}) diff --git a/.teamcity/delivery/staging/manifest/PublishLocal.kts b/.teamcity/delivery/staging/manifest/PublishLocal.kts deleted file mode 100644 index f2cafaa71..000000000 --- a/.teamcity/delivery/staging/manifest/PublishLocal.kts +++ /dev/null @@ -1,51 +0,0 @@ -package delivery.staging.manifest - -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildTypeSettings -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.general.teamCityStagingImagesSnapshot -import utils.dsl.steps.publishLinuxManifests -import utils.dsl.steps.publishWindowsManifests - -object publish_local : BuildType({ - name = "[All] [Staging] Release Manifests as 'version' into Staging Registry" - buildNumberPattern = "%dockerImage.teamcity.buildNumber%-%build.counter%" - description = "Publish Docker Manifests into staging repository." - 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""" - } - - publishLinuxManifests(name = "%tc.image.version%", - repo = "%docker.buildRepository%", - postfix = "%docker.buildImagePostfix%") - - - publishWindowsManifests(name = "%tc.image.version%", - repo = "%docker.buildRepository%", - postfix = "%docker.buildImagePostfix%") - } - - dependencies { - teamCityStagingImagesSnapshot() - } - - requirements { - noLessThanVer("docker.version", "18.05.0") - contains("docker.server.osType", "windows") - // In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent - doesNotContain("teamcity.agent.name", "arm") - contains("teamcity.agent.jvm.os.name", "Windows 10") - } - - features { - teamCityImageBuildFeatures() - } -}) diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml deleted file mode 100644 index f4fccce33..000000000 --- a/.teamcity/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - Docker_DockerImages Config DSL Script - Docker_DockerImages - Docker_DockerImages_dsl - 1.0-SNAPSHOT - - - org.jetbrains.teamcity - configs-dsl-kotlin-parent - 1.0-SNAPSHOT - - - - - jetbrains-all - https://download.jetbrains.com/teamcity-repository - - true - - - - - - - JetBrains - https://download.jetbrains.com/teamcity-repository - - - - - ${basedir} - - - kotlin-maven-plugin - org.jetbrains.kotlin - ${kotlin.version} - - - - - compile - process-sources - - compile - - - - test-compile - process-test-sources - - test-compile - - - - - - org.jetbrains.teamcity - teamcity-configs-maven-plugin - ${teamcity.dsl.version} - - kotlin - target/generated-configs - - - - - - - - org.jetbrains.teamcity - configs-dsl-kotlin - ${teamcity.dsl.version} - compile - - - org.jetbrains.teamcity - configs-dsl-kotlin-plugins - 1.0-SNAPSHOT - pom - compile - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin.version} - compile - - - org.jetbrains.kotlin - kotlin-script-runtime - ${kotlin.version} - compile - - - \ No newline at end of file diff --git a/.teamcity/scheduled/build/TeamCityDockerImageScheduledBuildLinuxManifest.kt b/.teamcity/scheduled/build/TeamCityDockerImageScheduledBuildLinuxManifest.kt deleted file mode 100644 index 2d2ab9fdb..000000000 --- a/.teamcity/scheduled/build/TeamCityDockerImageScheduledBuildLinuxManifest.kt +++ /dev/null @@ -1,48 +0,0 @@ -package scheduled.build - -import TeamCityScheduledImageBuildLinux_Base -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.FailureAction -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.publishLinuxManifests - - -object TeamCityDockerImageScheduledBuildLinuxManifest : BuildType({ - name = "[Linux] TeamCity Docker Images - Automated Scheduled Build - Linux - publish manifest" - description = "Creates and publishes manifest for image built for different architectures: AMD, ARM." - - params { - // the images will be published into registry that holds nightly builds - param("docker.buildRepository", "%docker.nightlyRepository%") - // no postfix needed - param("docker.buildImagePostfix", "") - param("tc.image.version", "%dockerImage.teamcity.buildNumber%") - } - - steps { - script { - name = "remove manifests" - scriptContent = - """if exist "%%USERPROFILE%%\.docker\manifests\" rmdir "%%USERPROFILE%%\.docker\manifests\" /s /q""" - } - - publishLinuxManifests(name = "%dockerImage.teamcity.buildNumber%", repo = "%docker.nightlyRepository%") - } - - features { - teamCityImageBuildFeatures() - } - - dependencies { - arrayOf( - TeamCityScheduledImageBuildLinux_Base("amd64", ""), - TeamCityScheduledImageBuildLinux_Base("aarch64", "arm") - ).forEach { - snapshot(it) { - onDependencyFailure = FailureAction.FAIL_TO_START - onDependencyCancel = FailureAction.FAIL_TO_START - } - } - } -}) diff --git a/.teamcity/scheduled/build/TeamCityDockerImagesScheduledBuild.kts b/.teamcity/scheduled/build/TeamCityDockerImagesScheduledBuild.kts deleted file mode 100644 index 100e0bc45..000000000 --- a/.teamcity/scheduled/build/TeamCityDockerImagesScheduledBuild.kts +++ /dev/null @@ -1,54 +0,0 @@ -package scheduled.build - -import TeamCityScheduledImageBuildLinux_Base -import jetbrains.buildServer.configs.kotlin.v2019_2.* -import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule - -/** - * Scheduled Composite Build of TeamCity Docker Images for each of supported platforms. - * Purpose: ensure that all dependencies within Docker Images are up-to-date. - */ -object TeamCityDockerImagesScheduledBuild : BuildType({ - name = "TeamCity Docker Images - Automated Scheduled Build" - description = "Regular automated build of TeamCity Docker Images" - - type = Type.COMPOSITE - - vcs { - showDependenciesChanges = true - } - - params { - // the images will be published into registry that holds nightly builds - param("docker.buildRepository", "%docker.nightlyRepository%") - // no postfix needed - param("docker.buildImagePostfix", "") - } - - triggers { - schedule { - id = "TRIGGER_TC_DOCKER_IMAGES_NIGHTLY" - schedulingPolicy = daily { - hour = 6 - minute = 30 - } - branchFilter = "+:" - withPendingChangesOnly = false - } - } - - dependencies { - arrayOf( - TeamCityScheduledImageBuildWindows.TeamCityScheduledImageBuildWindows, - TeamCityScheduledImageBuildLinux_Base("amd64", ""), - TeamCityScheduledImageBuildLinux_Base("aarch64", "arm") - ).forEach { - snapshot(it) { - // Once triggered, new Docker-compatible distribution is available - reuseBuilds = ReuseBuilds.NO - onDependencyFailure = FailureAction.ADD_PROBLEM - onDependencyCancel = FailureAction.CANCEL - } - } - } -}) diff --git a/.teamcity/scheduled/build/TeamCityScheduledImageBuildWindows.kts b/.teamcity/scheduled/build/TeamCityScheduledImageBuildWindows.kts deleted file mode 100644 index 58756f519..000000000 --- a/.teamcity/scheduled/build/TeamCityScheduledImageBuildWindows.kts +++ /dev/null @@ -1,74 +0,0 @@ -package scheduled.build - -import common.TeamCityDockerImagesRepo_AllBranches -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import utils.ImageInfoRepository -import utils.config.DeliveryConfig -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import utils.dsl.steps.buildImage -import utils.dsl.steps.publishToStaging - -/** - * Scheduled build of TeamCity Docker Images for Windows. - */ -object TeamCityScheduledImageBuildWindows : BuildType({ - name = "[amd64] TeamCity Docker Images - Automated Scheduled Build - Windows" - - vcs { - root(TeamCityDockerImagesRepo_AllBranches) - } - - params { - // the images will be published into registry that holds nightly builds - param("docker.buildRepository", "%docker.nightlyRepository%") - // no postfix needed - param("docker.buildImagePostfix", "") - param("tc.image.version", "%dockerImage.teamcity.buildNumber%") - } - - steps { - // TODO: Enable build of Windows 1809 images back -// // 1. Build Windows 1809-based images -// val win1809images = ImageInfoRepository.getWindowsImages1809( -// stagingRepo = "%docker.nightlyRepository%", -// version = "%dockerImage.teamcity.buildNumber%", -// prodRepo = "%docker.nightlyRepository%", -// dockerfileTag = DeliveryConfig.tcVersion -// ) -// win1809images.forEach { winImage1809 -> -// buildImage(winImage1809) -// } - - // 2. Publish Windows 1809 images into staging (nightly) repository -// win1809images.forEach { imageInfo -> publishToStaging(imageInfo) } - - // 3. Build Windows 2022-based images - val win2022images = ImageInfoRepository.getWindowsImages2022( - stagingRepo = "%docker.nightlyRepository%", - version = "%dockerImage.teamcity.buildNumber%", - prodRepo = "%docker.nightlyRepository%", - dockerfileTag = DeliveryConfig.tcVersion - ) - win2022images.forEach { winImage2022 -> - buildImage(winImage2022) - } - - // 4. Publish Windows 2022 images into staging (nightly) repository - win2022images.forEach { imageInfo -> publishToStaging(imageInfo) } - } - - dependencies { - teamCityBuildDistDocker() - } - - features { - teamCityImageBuildFeatures(requiredSpaceGb = 50) - } - - // An implicit Windows 10 requirement has been added in order to prevent DotNet's WebClient internal exception. - requirements { - contains("teamcity.agent.name", "teamcity-windows-2022") - // contains("teamcity.agent.jvm.os.name", "Windows 10") - } -}) diff --git a/.teamcity/scheduled/build/base/TeamCityScheduledImageBuildLinux_Base.kt b/.teamcity/scheduled/build/base/TeamCityScheduledImageBuildLinux_Base.kt deleted file mode 100644 index 292c1b302..000000000 --- a/.teamcity/scheduled/build/base/TeamCityScheduledImageBuildLinux_Base.kt +++ /dev/null @@ -1,101 +0,0 @@ -import common.TeamCityDockerImagesRepo -import common.TeamCityDockerImagesRepo_AllBranches -import utils.ImageInfoRepository -import utils.Utils -import utils.models.ImageInfo -import utils.dsl.steps.buildImage -import utils.dsl.steps.publishToStaging -import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType -import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.dockerSupport -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import utils.config.DeliveryConfig -import utils.config.Registries -import utils.dsl.general.teamCityBuildDistDocker -import utils.dsl.general.teamCityImageBuildFeatures -import java.lang.IllegalArgumentException - -/** - * Base class for the build of Linux-based Docker images. - * @param platform target platform, e.g. amd64, aarch64 (ARM) - * @param agentReq a substring that agent name ('teamcity.agent.name') must contain - */ -class TeamCityScheduledImageBuildLinux_Base(private val platform: String, private val agentReq: String) : BuildType({ - name = "[${platform}] TeamCity Docker Images - Automated Scheduled Build - Linux" - id("TeamCityScheduledImageBuildLinux_Base${platform}") - - vcs { - root(TeamCityDockerImagesRepo_AllBranches) - } - - // all .yml files (e.g. compose samples) - artifactRules = "+:*.yml" - - params { - // the images will be published into registry that holds nightly builds - param("docker.buildRepository", "%docker.nightlyRepository%") - // no postfix needed - param("docker.buildImagePostfix", "") - param("tc.image.version", "%dockerImage.teamcity.buildNumber%") - } - - steps { - val images: Set = when { - platform.lowercase().contains("arm") || platform.lowercase() - .contains("aarch") -> ImageInfoRepository.getArmLinuxImages2004( - stagingRepo = "%docker.nightlyRepository%", - version = "%dockerImage.teamcity.buildNumber%", - prodRepo = "%docker.nightlyRepository%", - dockerfileTag = DeliveryConfig.tcVersion - ) - - platform.lowercase().contains("amd") -> ImageInfoRepository.getAmdLinuxImages2004( - stagingRepo = "%docker.nightlyRepository%", - version = "%dockerImage.teamcity.buildNumber%", - prodRepo = "%docker.nightlyRepository%", - dockerfileTag = DeliveryConfig.tcVersion - ) - - else -> throw IllegalArgumentException("Unable to find images for specified platform [${platform}]") - } - - // build each image - images.forEach { imageInfo -> buildImage(imageInfo) } - - // publish images if build of each one of them succeeded - images.forEach { imageInfo -> publishToStaging(imageInfo) } - - script { - name = "Generate Sample docker-compose manifest for the created images" - scriptContent = """ - cat < teamcity-linux-%tc.image.version%.docker-compose.${platform.trim()}.yml - ${Utils.getSampleComposeFile("%docker.nightlyRepository%", "%tc.image.version%", "", platform)} - EOF - """.trimIndent() - } - } - - dependencies { - teamCityBuildDistDocker() - } - - features { - teamCityImageBuildFeatures(requiredSpaceGb = 8, registries = listOf(Registries.SPACE)) - } - - requirements { - // in case of aarch64, images must be built on aarch64-based agents - contains("teamcity.agent.name", agentReq) - } - - // We retain nightly builds for the previous 2 weeks - cleanup { - keepRule { - id = "TC_DOCKER_IMAGES_SCHEDULED_CLEANUP" - keepAtLeast = days(14) - dataToKeep = everything() - applyPerEachBranch = true - preserveArtifactsDependencies = true - } - } -}) diff --git a/.teamcity/scheduled/build/model/DockerImageInfo.kt b/.teamcity/scheduled/build/model/DockerImageInfo.kt deleted file mode 100644 index 255e29fe5..000000000 --- a/.teamcity/scheduled/build/model/DockerImageInfo.kt +++ /dev/null @@ -1,3 +0,0 @@ -package scheduled.build.model - -data class DockerImageInfo(val repository: String, val tag: String, val dockerfilePath: String) diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts deleted file mode 100644 index 75fd9c69c..000000000 --- a/.teamcity/settings.kts +++ /dev/null @@ -1,49 +0,0 @@ -import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo -import common.TeamCityDockerImagesRepo_AllBranches -import delivery.HubProject -import delivery.LocalProject -import scheduled.build.TeamCityDockerImagesScheduledBuild -import scheduled.build.TeamCityScheduledImageBuildWindows -import jetbrains.buildServer.configs.kotlin.v2019_2.Project -import jetbrains.buildServer.configs.kotlin.v2019_2.project -import jetbrains.buildServer.configs.kotlin.v2019_2.version -import scheduled.build.TeamCityDockerImageScheduledBuildLinuxManifest -import utils.config.DeliveryConfig - -version = "2019.2" - -object RootProject : Project({ - vcsRoot(TeamCityDockerImagesRepo) - vcsRoot(TeamCityDockerImagesRepo_AllBranches) - - // Staging registry - subProject(LocalProject.LocalProject) - - // Production registry - subProject(HubProject.HubProject) - - // Scheduled Builds - buildType(TeamCityDockerImagesScheduledBuild.TeamCityDockerImagesScheduledBuild) - buildType(TeamCityScheduledImageBuildWindows.TeamCityScheduledImageBuildWindows) - buildType(TeamCityScheduledImageBuildLinux_Base("amd64", "linux")) - buildType(TeamCityScheduledImageBuildLinux_Base("aarch64", "arm")) - buildType(TeamCityDockerImageScheduledBuildLinuxManifest) - - params { - // The build using the following parameters inherited from the hosting TeamCity Server: - // * %docker.deployRepository% - production repository - // * %docker.buildRepository% - staging repository - // Please, overwrite them here, if needed. - - param("dockerImage.teamcity.buildNumber", "%dep.${DeliveryConfig.buildDistDockerDepId}.build.number%") - // TeamCity version: EAP, 2023.05, etc. - param("tc.image.version", DeliveryConfig.tcVersion) - - param("teamcity.ui.settings.readOnly", "false") - - // Used by build for teamcity.jetbrains.com - param("hostedLinuxVersion", "20.04") - } -}) - -project(RootProject) diff --git a/.teamcity/utils/ImageInfoRepository.kt b/.teamcity/utils/ImageInfoRepository.kt deleted file mode 100644 index 8867f98c7..000000000 --- a/.teamcity/utils/ImageInfoRepository.kt +++ /dev/null @@ -1,233 +0,0 @@ -package utils - -import utils.models.ImageInfo -import java.lang.IllegalArgumentException - -/** - * Repository for information related to TeamCity Docker Images: registries, domain names, tags. - */ -class ImageInfoRepository { - companion object { - - /** - * Returns tags of all expected TeamCity Server instances. - */ - fun getAllServerTags(version: String = "%tc.image.version%"): List { - return listOf( - "$version-linux", - "$version-nanoserver-1809", - "$version-nanoserver-2022", - "$version-linux-arm64" - ) - } - - /** - * Returns tags of all expected TeamCity Agent instances. - */ - fun getAllAgentTags(version: String): List { - return listOf( - "$version-linux", - "$version-nanoserver-1809", - "$version-nanoserver-2022 ", - "$version-linux-arm64" - ) - } - - /** - * Returns tags for WindowsServerCore TeamCity Agents. - * Usually, they must match WinServerCore manifest, e.g. 'teamcity-agent:EAP-windowsservercore' - */ - fun getWindowsCoreAgentTags(version: String): List { - return listOf( - "${version}-windowsservercore-1809", - "${version}-windowsservercore-2022" - ) - } - - /** - * Returns the tags of all expected TeamCity Minimal Agent instances. - */ - fun getAllMinimalAgentTags(version: String): List { - // for now, the tags are equal to regular agent's - return getAllAgentTags(version) - } - - /** - * Returns a set of Ubuntu 20.04 (amd64)-based TeamCity Docker Images - */ - fun getAmdLinuxImages2004( - stagingRepo: String = "%docker.buildRepository%", - version: String = "%tc.image.version%", - dockerfileTag: String = "%tc.image.version%", - namePostfix: String = "%docker.buildImagePostfix%", - prodRepo: String = "%docker.deployRepository%" - ): Set { - return linkedSetOf( - // Minimal Agents - ImageInfo( - "teamcity-minimal-agent:${version}-linux", - "context/generated/linux/MinimalAgent/Ubuntu/20.04/Dockerfile", - "teamcity-minimal-agent:${dockerfileTag}-linux", - "${stagingRepo}teamcity-minimal-agent${namePostfix}:${version}-linux", - "${prodRepo}teamcity-minimal-agent:${version}-linux", - ), - - // Regular Agents - ImageInfo( - "teamcity-agent:${version}-linux", - "context/generated/linux/Agent/Ubuntu/20.04/Dockerfile", - "teamcity-agent:${dockerfileTag}-linux", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-linux", - "${prodRepo}teamcity-agent:${version}-linux" - ), - ImageInfo( - "teamcity-agent:${version}-linux-sudo", - "context/generated/linux/Agent/Ubuntu/20.04-sudo/Dockerfile", - "teamcity-agent:${dockerfileTag}-linux-sudo", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-linux-sudo", - "${prodRepo}teamcity-agent:${version}-linux-sudo" - ), - - // Servers - ImageInfo( - "teamcity-server:${version}-linux", - "context/generated/linux/Server/Ubuntu/20.04/Dockerfile", - "teamcity-server:${dockerfileTag}-linux", - "${stagingRepo}teamcity-server${namePostfix}:${version}-linux", - "${prodRepo}teamcity-server:${version}-linux" - ) - ) - } - - /** - * Returns a set of Ubuntu 20.04 (aarch64)-based TeamCity Docker Image. - * - */ - fun getArmLinuxImages2004( - stagingRepo: String = "%docker.buildRepository%", - version: String = "%tc.image.version%", - dockerfileTag: String = "%tc.image.version%", - namePostfix: String = "%docker.buildImagePostfix%", - prodRepo: String = "%docker.deployRepository%" - ): Set { - return linkedSetOf( - // Minimal Agents - ImageInfo( - "teamcity-minimal-agent:${version}-linux-arm64", - "context/generated/linux/MinimalAgent/UbuntuARM/20.04/Dockerfile", - "teamcity-minimal-agent:${dockerfileTag}-linux-arm64", - "${stagingRepo}teamcity-minimal-agent${namePostfix}:${version}-linux-arm64", - "${prodRepo}teamcity-minimal-agent:${version}-linux-arm64" - ), - - // Regular Agents - ImageInfo( - "teamcity-agent:${version}-linux-arm64", - "context/generated/linux/Agent/UbuntuARM/20.04/Dockerfile", - "teamcity-agent:${dockerfileTag}-linux-arm64", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-linux-arm64", - "${prodRepo}teamcity-agent:${version}-linux-arm64" - - ), - ImageInfo( - "teamcity-agent:${version}-linux-arm64-sudo", - "context/generated/linux/Agent/UbuntuARM/20.04-sudo/Dockerfile", - "teamcity-agent:${dockerfileTag}-linux-arm64-sudo", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-linux-arm64-sudo", - "${prodRepo}teamcity-agent:${version}-linux-arm64-sudo" - ), - - // Servers - ImageInfo( - "teamcity-server:${version}-linux-arm64", - "context/generated/linux/Server/UbuntuARM/20.04/Dockerfile", - "teamcity-server:${dockerfileTag}-linux-arm64", - "${stagingRepo}teamcity-server${namePostfix}:${version}-linux-arm64", - "${prodRepo}teamcity-server:${version}-linux-arm64" - ) - ) - } - - /** - * Returns the list of Windows 2022-based TeamCity Docker images. - */ - fun getWindowsImages2022( - stagingRepo: String = "%docker.buildRepository%", - version: String = "%tc.image.version%", - dockerfileTag: String = "%tc.image.version%", - namePostfix: String = "%docker.buildImagePostfix%", - prodRepo: String = "%docker.deployRepository%" - ): Set { - return getWindowsImages("2022", stagingRepo, version, dockerfileTag, namePostfix, prodRepo) - } - - /** - * Returns the list of Windows 1809-based TeamCity Docker images. - */ - fun getWindowsImages1809( - stagingRepo: String = "%docker.buildRepository%", - version: String = "%tc.image.version%", - dockerfileTag: String = "%tc.image.version%", - namePostfix: String = "%docker.buildImagePostfix%", - prodRepo: String = "%docker.deployRepository%" - ): Set { - return getWindowsImages("1809", stagingRepo, version, dockerfileTag, namePostfix, prodRepo) - } - - /** - * Returns list of Windows-based TeamCity images. - * The difference between their names / paths are only Windows version. - * - * @param winVersion version of Windows (1809 / 2004) - */ - private fun getWindowsImages(winVersion: String, - stagingRepo: String, - version: String, - dockerfileTag: String, - namePostfix: String, - prodRepo: String): Set { - if (!(winVersion == "1809" || winVersion == "2022")) { - throw IllegalArgumentException("Unsupported Windows version: [${winVersion}]") - } - - return linkedSetOf( - // Servers - ImageInfo( - "teamcity-server:${version}-nanoserver-${winVersion}", - "context/generated/windows/Server/nanoserver/${winVersion}/Dockerfile", - "teamcity-server:${dockerfileTag}-nanoserver-${winVersion}", - "${stagingRepo}teamcity-server${namePostfix}:${version}-nanoserver-${winVersion}", - "${prodRepo}teamcity-server:${version}-nanoserver-${winVersion}\"" - ), - - // Minimal Agent - nanoserver - ImageInfo( - "teamcity-minimal-agent:${version}-nanoserver-${winVersion}", - "context/generated/windows/MinimalAgent/nanoserver/${winVersion}/Dockerfile", - "teamcity-minimal-agent:${dockerfileTag}-nanoserver-${winVersion}", - "${stagingRepo}teamcity-minimal-agent${namePostfix}:${version}-nanoserver-${winVersion}", - "${prodRepo}teamcity-minimal-agent:${version}-nanoserver-${winVersion}" - ), - - // Agents - // Windows Server Core - ImageInfo( - "teamcity-agent:${version}-windowsservercore-${winVersion}", - "context/generated/windows/Agent/windowsservercore/${winVersion}/Dockerfile", - "teamcity-agent:${dockerfileTag}-windowsservercore-${winVersion}", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-windowsservercore-${winVersion}", - "${prodRepo}teamcity-agent:${version}-windowsservercore-${winVersion}" - ), - - // Nano server - ImageInfo( - "teamcity-agent:${version}-nanoserver-${winVersion}", - "context/generated/windows/Agent/nanoserver/${winVersion}/Dockerfile", - "teamcity-agent:${dockerfileTag}-nanoserver-${winVersion}", - "${stagingRepo}teamcity-agent${namePostfix}:${version}-nanoserver-${winVersion}", - "${prodRepo}teamcity-agent${namePostfix}:${version}-nanoserver-${winVersion}" - ) - ) - } - } -} diff --git a/.teamcity/utils/Utils.kt b/.teamcity/utils/Utils.kt deleted file mode 100644 index 248720bec..000000000 --- a/.teamcity/utils/Utils.kt +++ /dev/null @@ -1,135 +0,0 @@ -package utils - -import utils.models.ImageInfo - -/** - * Utilities for the build up of Docker images. - */ -class Utils { - companion object { - /** - * Returns .dockerignore context based on given image. - * @param info information about target Docker image - */ - fun getDockerignoreCtx(info: ImageInfo): String { - val imageFqdn = info.name.lowercase() - return when { - imageFqdn.contains("minimal") -> """ - echo 2> context/.dockerignore - echo TeamCity/webapps >> context/.dockerignore - echo TeamCity/devPackage >> context/.dockerignore - echo TeamCity/lib >> context/.dockerignore - """.trimIndent() - - imageFqdn.contains("server") -> """ - echo 2> context/.dockerignore - echo TeamCity/buildAgent >> context/.dockerignore - echo TeamCity/temp >> context/.dockerignore - """.trimIndent() - - imageFqdn.contains("agent") -> """ - echo 2> context/.dockerignore - echo TeamCity >> context/.dockerignore - """.trimIndent() - else -> "" - } - } - - /** - * Creates sample docker-compose manifest and returns file that matches it. - */ - fun getSampleComposeFile(repo: String, version: String, namePostfix: String = "", platform: String = "amd"): String { - val isArmArch = (platform.lowercase().contains("arm") || platform.lowercase().contains("arch")) - val dockerPlatformId = if (isArmArch) "linux/arm64" else "linux/amd64" - val platformPostfix = if (isArmArch) "-arm64" else "" - return """ - version: "3.3" - services: - linux-server: - - image: ${repo}teamcity-server${namePostfix}:${version}-linux${platformPostfix} - platform: $dockerPlatformId - - privileged: true - user: root - - environment: - - TEAMCITY_SERVER_OPTS="-Dteamcity.startup.maintenance=false -Dteamcity.csrf.origin.check.enabled=logOnly" - - TEAMCITY_SERVER_MEM_OPTS="-Xmx2048m" - ports: - - "8111:8111" - - volumes: - - ./docker-images-test/data/server:/data/teamcity_server/datadir - - ./docker-images-test/logs/server:/opt/teamcity/logs - - ./docker-images-test/temp/server:/opt/teamcity/temp - - healthcheck: - test: grep "TeamCity initialized" /opt/teamcity/logs/teamcity-server.log || exit 1 - interval: 1m - timeout: 15m - retries: 16 - - - linux-agent: - image: ${repo}teamcity-agent${namePostfix}:${version}-linux${platformPostfix} - platform: $dockerPlatformId - - depends_on: - - linux-server - - privileged: true - user: root - - environment: - - SERVER_URL=http://linux-server:8111 - - AGENT_NAME=tc-agent-linux-regular - - TEAMCITY_AGENT_EC2_DISABLE=true - volumes: - - ./docker-images-test/data/agent:/data/teamcity_agent/conf - - ./docker-images-test/logs/agent:/opt/buildagent/logs - - ./docker-images-test/temp/agent:/opt/buildagent/temp - - healthcheck: - # Plugin initialization should be completed at this point - test: grep "Build Agent version" /opt/buildagent/logs/teamcity-agent.log || exit 1 - interval: 1m - timeout: 15m - retries: 16 - - linux-minimal-agent: - image: ${repo}teamcity-minimal-agent:${version}-linux${platformPostfix} - platform: $dockerPlatformId - - privileged: true - user: root - - depends_on: - - linux-server - - deploy: - resources: - limits: - memory: 2000m - reservations: - memory: 2000m - environment: - - SERVER_URL=http://linux-server:8111 - - AGENT_NAME=tc-agent-linux-minimal - - TEAMCITY_AGENT_EC2_DISABLE=true - - volumes: - - ./docker-images-test/data/min-agent:/data/teamcity_agent/conf - - ./docker-images-test/logs/min-agent:/opt/buildagent/logs - - ./docker-images-test/temp/min-agent:/opt/buildagent/temp - - healthcheck: - # Plugin initialization should be completed at this point - test: grep "Build Agent version" /opt/buildagent/logs/teamcity-agent.log || exit 1 - interval: 1m - timeout: 15m - retries: 16 - """ - } - } -} diff --git a/.teamcity/utils/config/DeliveryConfig.kt b/.teamcity/utils/config/DeliveryConfig.kt deleted file mode 100644 index 8e5b850a8..000000000 --- a/.teamcity/utils/config/DeliveryConfig.kt +++ /dev/null @@ -1,15 +0,0 @@ -package utils.config - -/** - * Holds Delivery-related configuration. - */ -class DeliveryConfig { - companion object { - // Configuration within remote TeamCity Instance, thus the ID is stored as string - const val buildDistDockerDepId = "TC_Trunk_BuildDistDocker" - - // Version must correspond to generated Dockerfiles, as minimal agent is a ... - // ... base image for regular agent. - const val tcVersion = "EAP" - } -} diff --git a/.teamcity/utils/config/Registries.kt b/.teamcity/utils/config/Registries.kt deleted file mode 100644 index 37cfe963a..000000000 --- a/.teamcity/utils/config/Registries.kt +++ /dev/null @@ -1,11 +0,0 @@ -package utils.config - -/** - * Contains IDs for connections. - */ -class Registries { - companion object { - const val SPACE = "PROJECT_EXT_315" - const val HUB = "PROJECT_EXT_774" - } -} diff --git a/.teamcity/utils/dsl/general/DslUtils.kt b/.teamcity/utils/dsl/general/DslUtils.kt deleted file mode 100644 index dd13c9a22..000000000 --- a/.teamcity/utils/dsl/general/DslUtils.kt +++ /dev/null @@ -1,123 +0,0 @@ -package utils.dsl.general - -import delivery.production.PushHubLinux -import delivery.production.PushHubWindows -import delivery.staging.PushLocalLinux2004 -import delivery.staging.PushLocalWindows1809 -import delivery.staging.PushLocalWindows2004 -import delivery.staging.manifest.PublishLocal -import delivery.arm.PushProductionLinux2004_Aarch64 -import delivery.arm.PushStagingLinux2004_Aarch64 -import jetbrains.buildServer.configs.kotlin.v2019_2.* -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 utils.config.DeliveryConfig -import utils.config.Registries - -/** - * - * The file encapsulated general utilities for Kotlin DSL: shared VCS roots, dependencies, steps, etc. - * It couldn't be included into a companion object as a static method, thus they're provided as a ... - * ... set of methods. - * - */ - - -/** - * Provides snapshot dependency on TeamCity Build compatible with Docker. - */ -fun Dependencies.teamCityBuildDistDocker() { - this.dependency(AbsoluteId(DeliveryConfig.buildDistDockerDepId)) { - snapshot { - onDependencyFailure = FailureAction.IGNORE - reuseBuilds = ReuseBuilds.ANY - } - artifacts { - artifactRules = "TeamCity.zip!/**=>context/TeamCity" - } - } -} - -/** - * Dependency on successful publishing of staging manifests. - */ -fun Dependencies.publishStagingManifests() { - snapshot(PublishLocal.publish_local) { - onDependencyFailure = FailureAction.FAIL_TO_START - } -} - -/** - * Returns snapshot dependencies on build configurations required for publishing Staging Images of TeamCity. - */ -fun Dependencies.teamCityStagingImagesSnapshot() { - snapshot(AbsoluteId(DeliveryConfig.buildDistDockerDepId)) { - 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 - } - - snapshot(PushStagingLinux2004_Aarch64.push_staging_linux_2004_aarch64) { - onDependencyFailure = FailureAction.FAIL_TO_START - } -} - -/** - * Returns snapshot dependencies on build configurations required for publishing Production Images of TeamCity. - */ -fun Dependencies.teamCityProdImagesSnapshot() { - snapshot(AbsoluteId(DeliveryConfig.buildDistDockerDepId)) { - onDependencyFailure = FailureAction.IGNORE - } - - snapshot(PushHubLinux.push_hub_linux) { - onDependencyFailure = FailureAction.FAIL_TO_START - } - - snapshot(PushProductionLinux2004_Aarch64.push_production_linux_2004_aarch64) { - onDependencyFailure = FailureAction.FAIL_TO_START - } - - snapshot(PushHubWindows.push_hub_windows) { - onDependencyFailure = FailureAction.FAIL_TO_START - } -} - -/** - * Shared features required for the build of TeamCity Docker Images. - * - * @param requiredSpaceGb space required for the build (more for image build-up, less for metadata (tag)) - * @param registries list of supported Docker Registries - * @param useCleanup indicates if pushed images should be cleaned up during server clean up - */ -fun BuildFeatures.teamCityImageBuildFeatures(requiredSpaceGb: Int = 1, - registries: List = listOf(Registries.SPACE, Registries.HUB), - useCleanup: Boolean = false) { - this.freeDiskSpace { - requiredSpace = "${requiredSpaceGb}gb" - failBuild = true - } - - this.dockerSupport { - cleanupPushedImages = useCleanup - loginToRegistry = on { - dockerRegistryId = registries.joinToString(",") - } - } - - this.swabra { - forceCleanCheckout = true - } -} diff --git a/.teamcity/utils/dsl/steps/DockerSteps.kt b/.teamcity/utils/dsl/steps/DockerSteps.kt deleted file mode 100644 index e88c7d8d4..000000000 --- a/.teamcity/utils/dsl/steps/DockerSteps.kt +++ /dev/null @@ -1,180 +0,0 @@ -package utils.dsl.steps - -import utils.Utils -import utils.models.ImageInfo -import jetbrains.buildServer.configs.kotlin.v2019_2.BuildSteps -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand -import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script -import utils.ImageInfoRepository -import utils.config.DeliveryConfig - -/** - * - * The file contains wrappers across build steps that'd be useful in context of Docker Image creation. - * - */ - - -/** - * Build given image: sets context, builds it, adds tag. - */ -fun BuildSteps.buildImage(imageInfo: ImageInfo) { - this.script { - name = "Set build context for [${imageInfo.name}]" - scriptContent = Utils.getDockerignoreCtx(imageInfo) - } - - this.dockerCommand { - name = "Build [${imageInfo.name}]" - commandType = build { - source = file { - path = imageInfo.dockerfilePath - } - contextDir = "context" - commandArgs = "--no-cache" - namesAndTags = imageInfo.baseFqdn.trimIndent() - } - } - - this.dockerCommand { - name = "Tag image for staging [${imageInfo.baseFqdn}]" - commandType = other { - subCommand = "tag" - commandArgs = "${imageInfo.baseFqdn} ${imageInfo.stagingFqdn}" - } - } -} - -/** - * Publishes provided image into its registry. - */ -fun BuildSteps.publishToStaging(imageInfo: ImageInfo) { - this.dockerCommand { - name = "Push image to registry - [${imageInfo.stagingFqdn}]" - commandType = push { - namesAndTags = imageInfo.stagingFqdn.trimIndent() - removeImageAfterPush = false - } - } -} - -/** - * Build and publishes given Docker image into staging repository. - */ -fun BuildSteps.buildAndPushToStaging(imageInfo: ImageInfo) { - buildImage(imageInfo) - publishToStaging(imageInfo) -} - -/** - * Moves given image from staging into production repository. - */ -fun BuildSteps.moveToProduction(image: ImageInfo) { - this.dockerCommand { - name = "Pull image [${image.name}] for further re-tagging" - commandType = other { - subCommand = "pull" - commandArgs = image.stagingFqdn - } - } - - this.dockerCommand { - name = "Re-tag image [${image.name}] for publishing into [${image.productionFqdn}]" - commandType = other { - subCommand = "tag" - commandArgs = "${image.stagingFqdn} ${image.productionFqdn}" - } - } - - this.dockerCommand { - name = "Publish [${image.productionFqdn}] after re-tag" - commandType = push { - namesAndTags = image.productionFqdn - // must always be disabled - no need to clear-up images from production registry - removeImageAfterPush = false - } - } -} - -/** - * Create a manifest list for annotating images & publishes it into registry. - * @param imageName domain name of image - * @param tags list of tags that'd be associated with the manifest - * @param manifestTag tag of the manifest, with which given tags will be associated, e.g. 'latest' - */ -fun BuildSteps.publishManifest(imageName: String, tags: List, manifestTag: String = DeliveryConfig.tcVersion) { - // manifest name - val manifestName = "${imageName}:${manifestTag}" - - val matchingManifests = StringBuilder() - tags.forEach { tag -> matchingManifests.append(" ${imageName}:$tag")} - - this.dockerCommand { - name = "Create manifest for [${imageName}]" - commandType = other { - subCommand = "manifest" - // - - commandArgs = "create $manifestName $matchingManifests" - } - } - - this.dockerCommand { - name = "Push manifest for [${imageName}]" - commandType = other { - subCommand = "manifest" - commandArgs = "push $manifestName" - } - } - - dockerCommand { - name = "Print-out manifest for [${imageName}]" - commandType = other { - subCommand = "manifest" - commandArgs = "inspect $manifestName --verbose" - } - } -} - -/** - * Publishes manifest for Linux-based images. - * @param name manifest name (usually, either 'latest' or release tag) - * @param repo target Docker registry - * @param postfix (optional) postfix for image name (e.g. "-staging") - * @param version (optional) image tag, by default equals to manifest name - */ -fun BuildSteps.publishLinuxManifests(name: String, repo: String, postfix: String = "", version: String = "") { - val ver = version.ifEmpty { name } - - // 1. Publish Server Manifests - val serverTags = ImageInfoRepository.getAllServerTags(ver) - publishManifest("${repo}teamcity-server${postfix}", serverTags, name) - - // 2. Publish Agent Manifests - val agentTags = ImageInfoRepository.getAllAgentTags(ver) - publishManifest("${repo}teamcity-agent${postfix}", agentTags, name) - - // 3. Publish Minimal Agent Manifests - val minAgentTags = ImageInfoRepository.getAllMinimalAgentTags(ver) - publishManifest( - "${repo}teamcity-minimal-agent${postfix}", - minAgentTags, - name - ) -} - -/** - * Publishes manifest for Windows-based images. - * Currently, only Windows Server Core is published. - * @param name manifest name (usually, either 'latest' or release tag) - * @param repo target Docker registry - * @param postfix (optional) postfix for image name (e.g. "-staging") - * @param version (optional) image tag, by default equals to manifest name - */ -fun BuildSteps.publishWindowsManifests(name: String, repo: String, postfix: String = "", version: String = "") { - val agentTagsWinServerCore = ImageInfoRepository.getWindowsCoreAgentTags(version) - publishManifest( - "${repo}teamcity-agent${postfix}", - agentTagsWinServerCore, - "${name}-windowsservercore" - ) -} diff --git a/.teamcity/utils/models/ImageInfo.kt b/.teamcity/utils/models/ImageInfo.kt deleted file mode 100644 index d9fb9e03f..000000000 --- a/.teamcity/utils/models/ImageInfo.kt +++ /dev/null @@ -1,14 +0,0 @@ -package utils.models - -/** - * Holds data about the building docker image. - */ -data class ImageInfo( - val name: String, - val dockerfilePath: String, - // 'baseFqdn' - basic image domain name, could be used as a reference within Dockerfile (e.g. for base image) - // 'stagingFqdn' - domain name of the image, including the registry, which will be used for deployment - val baseFqdn: String, - val stagingFqdn: String, - val productionFqdn: String -) diff --git a/README.md b/README.md index 0d0389838..38654ec5c 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,6 @@ This image adds a TeamCity agent suitable for Java and .NET development. ### 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. -- [Delivery Documentation](docs/DELIVERY.md) - documentation for delivery process. ### Bugs/issues/problems diff --git a/docs/DELIVERY.md b/docs/DELIVERY.md deleted file mode 100644 index 07e3e1065..000000000 --- a/docs/DELIVERY.md +++ /dev/null @@ -1,27 +0,0 @@ -# TeamCity Docker Images Delivery Pipeline - -[.teamcity](../.teamcity) holds Kotlin DSL-based build configurations that define delivery process -for TeamCity Docker Images. - -## Structure - -``` -.teamcity -├── common # Common entities (VCS roots, etc.) for delivery build configurations. -├── generated - └── inactive # Inactive configurations - └── production # Delivery into production registry - └── staging # Build of image & delivery into staging registry -├── hosted - └── arm # Build of ARM-based images - └── scheduled # Scheduled build of images (e.g. nightly) - └── utils # Common DSL utils (shared requirements, dependencies, etc.) -``` - -## Changes for the creation of new release - -To modify the parameters for a specific TeamCity release, kindly follow these steps: -1. Generate Dockerfiles for the images by referring to the ["build your custom docker images"](../README.md) documentation. -2. Configure the build configurations by making modifications to the [DeliveryConfig.kt](../.teamcity/utils/config/DeliveryConfig.kt) file: -* Update the `buildDistDockerDepId` field: This field requires the ID of the build configuration that provides an archive with the ProductProduct created for Docker Images. -* Update the `tcVersion` field: This field represents the current version of TeamCity, such as `EAP`, `2023.05.1`, and so on.