Skip to content

Commit

Permalink
[TEAMCITY-QA-T-289] Prevent build of AMD images on ARM agents (#76)
Browse files Browse the repository at this point in the history
* Update DSL generation to reflect prevention of potential AMD iamges build up on ARM agents.

* Re-generate DSLs based on new generation requirements.
  • Loading branch information
AndreyKoltsov1997 authored Jun 8, 2023
1 parent 5857905 commit fbce91b
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions .teamcity/generated/HubProject.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object HubProject : Project({
name = "Docker hub"
Expand Down
1 change: 1 addition & 0 deletions .teamcity/generated/LocalProject.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object LocalProject : Project({
name = "Staging registry"
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/generated/PublishHubVersion.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object publish_hub_version: BuildType({
name = "Publish as version"
Expand Down Expand Up @@ -137,6 +138,8 @@ object publish_hub_version: BuildType({
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 {
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/generated/PublishLocal.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object publish_local: BuildType({
name = "Publish"
Expand Down Expand Up @@ -142,6 +143,8 @@ object publish_local: BuildType({
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 {
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/generated/PushHubLinux.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_hub_linux: BuildType({
name = "Push linux"
Expand Down Expand Up @@ -164,6 +165,8 @@ object push_hub_linux: BuildType({
}
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 {
snapshot(PublishLocal.publish_local) {
Expand Down
3 changes: 3 additions & 0 deletions .teamcity/generated/PushHubWindows.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_hub_windows: BuildType({
name = "Push windows"
Expand Down Expand Up @@ -280,6 +281,8 @@ object push_hub_windows: BuildType({
}
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 {
Expand Down
1 change: 1 addition & 0 deletions .teamcity/generated/PushLocalLinux1804.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_linux_18_04 : BuildType({
name = "ON PAUSE Build and push linux 18.04"
Expand Down
5 changes: 4 additions & 1 deletion .teamcity/generated/PushLocalLinux2004.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_linux_20_04 : BuildType({
name = "Build and push linux 20.04"
Expand Down Expand Up @@ -331,7 +332,7 @@ object push_local_linux_20_04 : BuildType({
dockerSupport {
cleanupPushedImages = true
loginToRegistry = on {
dockerRegistryId = "PROJECT_EXT_774,PROJECT_EXT_315"
dockerRegistryId = "PROJECT_EXT_774"
}
}
swabra {
Expand All @@ -353,6 +354,8 @@ object push_local_linux_20_04 : BuildType({
param("system.teamcity.agent.ensure.free.space", "8gb")
}
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")
}
})

1 change: 1 addition & 0 deletions .teamcity/generated/PushLocalWindows1803.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_windows_1803 : BuildType({
name = "ON PAUSE Build and push windows 1803"
Expand Down
5 changes: 4 additions & 1 deletion .teamcity/generated/PushLocalWindows1809.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_windows_1809 : BuildType({
name = "Build and push windows 1809"
Expand Down Expand Up @@ -255,7 +256,7 @@ object push_local_windows_1809 : BuildType({
dockerSupport {
cleanupPushedImages = true
loginToRegistry = on {
dockerRegistryId = "PROJECT_EXT_774,PROJECT_EXT_315"
dockerRegistryId = "PROJECT_EXT_774"
}
}
swabra {
Expand All @@ -277,6 +278,8 @@ object push_local_windows_1809 : BuildType({
param("system.teamcity.agent.ensure.free.space", "43gb")
}
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")
}
})
Expand Down
1 change: 1 addition & 0 deletions .teamcity/generated/PushLocalWindows1903.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_windows_1903 : BuildType({
name = "ON PAUSE Build and push windows 1903"
Expand Down
1 change: 1 addition & 0 deletions .teamcity/generated/PushLocalWindows1909.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_windows_1909 : BuildType({
name = "ON PAUSE Build and push windows 1909"
Expand Down
5 changes: 4 additions & 1 deletion .teamcity/generated/PushLocalWindows2004.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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
import hosted.BuildAndPushHosted

object push_local_windows_2004 : BuildType({
name = "Build and push windows 2004"
Expand Down Expand Up @@ -255,7 +256,7 @@ object push_local_windows_2004 : BuildType({
dockerSupport {
cleanupPushedImages = true
loginToRegistry = on {
dockerRegistryId = "PROJECT_EXT_774,PROJECT_EXT_315"
dockerRegistryId = "PROJECT_EXT_774"
}
}
swabra {
Expand All @@ -277,6 +278,8 @@ object push_local_windows_2004 : BuildType({
param("system.teamcity.agent.ensure.free.space", "43gb")
}
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")
}
})
Expand Down
7 changes: 6 additions & 1 deletion tool/TeamCity.Docker/TeamCityKotlinSettingsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ private IEnumerable<string> CreateImageValidationConfig(string buildTypeId, IEnu
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
// VCS Root Is needed in order to launch automation framework
yield return String.Join('\n',
"\t vcs {",
"\t\t root(TeamCityDockerImagesRepo)",
Expand Down Expand Up @@ -570,6 +570,11 @@ private static IEnumerable<string> CreateDockerRequirements(IReadOnlyCollection<
yield return $"\t contains(\"docker.server.osType\", \"{platform}\")";
}

if (!IsArmBasedImageBuildEnabled) {
yield return "\t// In order to correctly build AMD-based images, we wouldn't want it to be scheduled on ARM-based agent";
yield return $"\tdoesNotContain(\"teamcity.agent.name\", \"arm\")";
}

foreach (var requirement in requirements)
{
if (string.IsNullOrWhiteSpace(requirement.Value))
Expand Down

0 comments on commit fbce91b

Please sign in to comment.