Skip to content

Commit

Permalink
[TEAMCITY-QA-T] Add an internment DSL update for the scheduled build …
Browse files Browse the repository at this point in the history
…of Windows images.
  • Loading branch information
AndreyKoltsov1997 committed Oct 13, 2023
1 parent ca91674 commit 2fb092e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .teamcity/delivery/production/PushHubWindows.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object push_hub_windows : BuildType({
}

// Move Windows 2004-based Docker Images into production registry
ImageInfoRepository.getWindowsImages2004().forEach { imageInfo ->
ImageInfoRepository.getWindowsImages2022().forEach { imageInfo ->
moveToProduction(imageInfo)
}
}
Expand Down
20 changes: 10 additions & 10 deletions .teamcity/delivery/staging/PushLocalWindows2004.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ 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 2004-based TeamCity Docker images and pushes them into staging registry.\n" +
"Target images: teamcity-server (NanoServer 2004), minimal agent (NanoServer 2004), " +
"regular agent (NanoServer 2004, WindowsServer Core 2004)."
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)
Expand All @@ -25,30 +25,30 @@ object push_local_windows_2004 : BuildType({

steps {
dockerCommand {
name = "pull mcr.microsoft.com/powershell:nanoserver-2004"
name = "pull mcr.microsoft.com/powershell:nanoserver-ltsc2022"
commandType = other {
subCommand = "pull"
commandArgs = "mcr.microsoft.com/powershell:nanoserver-2004"
commandArgs = "mcr.microsoft.com/powershell:nanoserver-ltsc2022"
}
}

dockerCommand {
name = "pull mcr.microsoft.com/windows/nanoserver:2004"
name = "pull mcr.microsoft.com/windows/nanoserver:ltsc2022"
commandType = other {
subCommand = "pull"
commandArgs = "mcr.microsoft.com/windows/nanoserver:2004"
commandArgs = "mcr.microsoft.com/windows/nanoserver:ltsc2022"
}
}

dockerCommand {
name = "pull mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-2004"
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-2004"
commandArgs = "mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022"
}
}

ImageInfoRepository.getWindowsImages2004().forEach { imageInfo ->
ImageInfoRepository.getWindowsImages2022().forEach { imageInfo ->
buildAndPushToStaging(imageInfo)
}
}
Expand Down
35 changes: 18 additions & 17 deletions .teamcity/scheduled/build/TeamCityScheduledImageBuildWindows.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,34 @@ object TeamCityScheduledImageBuildWindows : BuildType({
}

steps {
// 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)
}
// 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) }
// win1809images.forEach { imageInfo -> publishToStaging(imageInfo) }

// 3. Build Windows 2004-based images
val win2004images = ImageInfoRepository.getWindowsImages2004(
// 3. Build Windows 2022-based images
val win2022images = ImageInfoRepository.getWindowsImages2022(
stagingRepo = "%docker.nightlyRepository%",
version = "%dockerImage.teamcity.buildNumber%",
prodRepo = "%docker.nightlyRepository%",
dockerfileTag = DeliveryConfig.tcVersion
)
win2004images.forEach { winImage2004 ->
buildImage(winImage2004)
win2022images.forEach { winImage2022 ->
buildImage(winImage2022)
}

// 4. Publish Windows 2004 images into staging (nightly) repository
win2004images.forEach { imageInfo -> publishToStaging(imageInfo) }
// 4. Publish Windows 2022 images into staging (nightly) repository
win2022images.forEach { imageInfo -> publishToStaging(imageInfo) }
}

dependencies {
Expand Down
14 changes: 7 additions & 7 deletions .teamcity/utils/ImageInfoRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ImageInfoRepository {
return listOf(
"$version-linux",
"$version-nanoserver-1809",
"$version-nanoserver-2004",
"$version-nanoserver-2022",
"$version-linux-arm64"
)
}
Expand All @@ -28,7 +28,7 @@ class ImageInfoRepository {
return listOf(
"$version-linux",
"$version-nanoserver-1809",
"$version-nanoserver-2004 ",
"$version-nanoserver-2022 ",
"$version-linux-arm64"
)
}
Expand All @@ -40,7 +40,7 @@ class ImageInfoRepository {
fun getWindowsCoreAgentTags(version: String): List<String> {
return listOf(
"${version}-windowsservercore-1809",
"${version}-windowsservercore-2004"
"${version}-windowsservercore-2022"
)
}

Expand Down Expand Up @@ -149,16 +149,16 @@ class ImageInfoRepository {
}

/**
* Returns the list of Windows 2004-based TeamCity Docker images.
* Returns the list of Windows 2022-based TeamCity Docker images.
*/
fun getWindowsImages2004(
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<ImageInfo> {
return getWindowsImages("2004", stagingRepo, version, dockerfileTag, namePostfix, prodRepo)
return getWindowsImages("2022", stagingRepo, version, dockerfileTag, namePostfix, prodRepo)
}

/**
Expand Down Expand Up @@ -186,7 +186,7 @@ class ImageInfoRepository {
dockerfileTag: String,
namePostfix: String,
prodRepo: String): Set<ImageInfo> {
if (!(winVersion == "1809" || winVersion == "2004")) {
if (!(winVersion == "1809" || winVersion == "2022")) {
throw IllegalArgumentException("Unsupported Windows version: [${winVersion}]")
}

Expand Down

0 comments on commit 2fb092e

Please sign in to comment.