-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement composite build for automated, scheduled creation of Window…
…s / Linux Docker Images. (#49) * Implement composite build for creation of Windows / Linux Docker Images on nightly basis. * * Change declaration of target platform of particular Docker Image. * Rename 'nightly' to 'scheduled' in order to have a more generic name. * Rename names and description for builds responsible for automated build of Docker images. * Update name and description of composite build.
- Loading branch information
1 parent
29b92b2
commit 36d007d
Showing
4 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
.teamcity/hosted/scheduled/build/TeamCityDockerImagesScheduledBuild.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package hosted.scheduled.build | ||
|
||
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 | ||
} | ||
|
||
triggers { | ||
schedule { | ||
id = "TRIGGER_TC_DOCKER_IMAGES_NIGHTLY" | ||
schedulingPolicy = daily { | ||
hour = 0 | ||
minute = 15 | ||
} | ||
branchFilter = "+:<default>" | ||
withPendingChangesOnly = false | ||
} | ||
} | ||
|
||
dependencies { | ||
arrayOf( | ||
TeamCityScheduledImageBuildWindows.TeamCityScheduledImageBuildWindows, | ||
TeamCityScheduledImageBuildLinux.TeamCityScheduledImageBuildLinux | ||
).forEach { | ||
snapshot(it) { | ||
onDependencyFailure = FailureAction.ADD_PROBLEM | ||
onDependencyCancel = FailureAction.CANCEL | ||
} | ||
} | ||
} | ||
}) |
51 changes: 51 additions & 0 deletions
51
.teamcity/hosted/scheduled/build/TeamCityScheduledImageBuildLinux.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package hosted.scheduled.build | ||
|
||
import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.DockerCommandStep | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand | ||
|
||
|
||
/** | ||
* Scheduled build of TeamCity Docker Images for Linux. | ||
*/ | ||
object TeamCityScheduledImageBuildLinux : BuildType({ | ||
name = "TeamCity Docker Images - Automated Scheduled Build - Linux" | ||
|
||
vcs { | ||
root(TeamCityDockerImagesRepo) | ||
} | ||
|
||
// <image name> - <dockerfile path> | ||
val targetImages: HashMap<String, String> = hashMapOf( | ||
// Ubuntu 20.04 | ||
"teamcity-server-linux-20-04" to "context/generated/linux/Server/Ubuntu/20.04/Dockerfile", | ||
"teamcity-minimal-agent-linux-20-04" to "context/generated/linux/MinimalAgent/Ubuntu/20.04/Dockerfile", | ||
"teamcity-agent-linux-20-04" to "context/generated/linux/Agent/Ubuntu/20.04/Dockerfile", | ||
"teamcity-agent-linux-sudo-20-04" to "context/generated/linux/Agent/Ubuntu/20.04-sudo/Dockerfile", | ||
// -- ARM images are commented out since TeamCity, currently, does not support it | ||
// "teamcity-agent-linux-arm64-20-04" to "context/generated/linux/Agent/UbuntuARM/20.04/Dockerfile", | ||
// "teamcity-agent-linux-arm64-sudo-20-04" to "context/generated/linux/Agent/UbuntuARM/20.04-sudo/Dockerfile", | ||
) | ||
|
||
steps { | ||
targetImages.forEach { (imageName, dockerfilePath) -> | ||
dockerCommand { | ||
name = "build $imageName" | ||
commandType = build { | ||
source = file { | ||
path = dockerfilePath | ||
} | ||
platform = DockerCommandStep.ImagePlatform.Linux | ||
contextDir = "context" | ||
namesAndTags = "${imageName}:%dockerImage.teamcity.buildNumber%" | ||
} | ||
} | ||
} | ||
} | ||
|
||
requirements { | ||
contains("docker.server.osType", "linux") | ||
contains("system.agent.name", "docker") | ||
} | ||
}) |
53 changes: 53 additions & 0 deletions
53
.teamcity/hosted/scheduled/build/TeamCityScheduledImageBuildWindows.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package hosted.scheduled.build | ||
|
||
import common.TeamCityDockerImagesRepo.TeamCityDockerImagesRepo | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.DockerCommandStep | ||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand | ||
|
||
/** | ||
* Scheduled build of TeamCity Docker Images for Windows. | ||
*/ | ||
object TeamCityScheduledImageBuildWindows : BuildType({ | ||
name = "TeamCity Docker Images - Automated Scheduled Build - Windows" | ||
|
||
vcs { | ||
root(TeamCityDockerImagesRepo) | ||
} | ||
|
||
// <image name> - <dockerfile path> | ||
val targetImages: HashMap<String, String> = hashMapOf( | ||
// Windows 1809 | ||
"teamcity-server-nanoserver-1809" to "context/generated/windows/Server/nanoserver/1809/Dockerfile", | ||
"teamcity-minimal-agent-nanoserver-1809" to "context/generated/windows/MinimalAgent/nanoserver/1809/Dockerfile", | ||
"teamcity-agent-windowsservercore-1809" to "context/generated/windows/Agent/windowsservercore/1809/Dockerfile", | ||
"teamcity-agent-nanoserver-1809" to "context/generated/windows/Agent/nanoserver/1809/Dockerfile", | ||
|
||
// Windows 20.04 | ||
"teamcity-server-nanoserver-2004" to "context/generated/windows/Server/nanoserver/2004/Dockerfile", | ||
"teamcity-minimal-agent-nanoserver-2004" to "context/generated/windows/MinimalAgent/nanoserver/2004/Dockerfile", | ||
"teamcity-agent-windowsservercore-2004" to "context/generated/windows/Agent/windowsservercore/2004/Dockerfile", | ||
"teamcity-agent-nanoserver-2004" to "context/generated/windows/Agent/nanoserver/2004/Dockerfile", | ||
) | ||
|
||
steps { | ||
targetImages.forEach { (imageName, dockerfilePath) -> | ||
dockerCommand { | ||
name = "build $imageName" | ||
commandType = build { | ||
source = file { | ||
path = dockerfilePath | ||
} | ||
platform = DockerCommandStep.ImagePlatform.Windows; | ||
contextDir = "context" | ||
namesAndTags = "${imageName}:%dockerImage.teamcity.buildNumber%" | ||
} | ||
} | ||
} | ||
} | ||
|
||
requirements { | ||
contains("docker.server.osType", "windows") | ||
contains("system.agent.name", "docker") | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters