Skip to content

Commit

Permalink
* Add configurable cleanup. (#94)
Browse files Browse the repository at this point in the history
* Explicitly disable cleanup where not needed.
  • Loading branch information
AndreyKoltsov1997 authored Jul 27, 2023
1 parent b0c32dd commit 2a744db
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .teamcity/delivery/arm/PushProductionLinux2004_Aarch64.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object push_production_linux_2004_aarch64 : BuildType({
}

features {
teamCityImageBuildFeatures()
teamCityImageBuildFeatures(useCleanup = false)
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/delivery/production/PushHubLinux.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object push_hub_linux : BuildType({
}

features {
teamCityImageBuildFeatures(requiredSpaceGb = 4)
teamCityImageBuildFeatures(requiredSpaceGb = 4, useCleanup = false)
}

requirements {
Expand Down
2 changes: 1 addition & 1 deletion .teamcity/delivery/production/PushHubWindows.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object push_hub_windows : BuildType({

features {
// Windows Images Require more disk space
teamCityImageBuildFeatures(requiredSpaceGb = 52)
teamCityImageBuildFeatures(requiredSpaceGb = 52, useCleanup = false)
}

requirements {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ object publish_hub_latest : BuildType({
}

features {
teamCityImageBuildFeatures()
teamCityImageBuildFeatures(useCleanup = false)
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ object publish_hub_version : BuildType({
}

features {
teamCityImageBuildFeatures()
teamCityImageBuildFeatures(useCleanup = false)
}
})
6 changes: 4 additions & 2 deletions .teamcity/utils/dsl/general/DslUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,18 @@ fun Dependencies.teamCityProdImagesSnapshot() {
*
* @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<String> = listOf(Registries.SPACE, Registries.HUB)) {
registries: List<String> = listOf(Registries.SPACE, Registries.HUB),
useCleanup: Boolean = false) {
this.freeDiskSpace {
requiredSpace = "${requiredSpaceGb}gb"
failBuild = true
}

this.dockerSupport {
cleanupPushedImages = true
cleanupPushedImages = useCleanup
loginToRegistry = on {
dockerRegistryId = registries.joinToString(",")
}
Expand Down

0 comments on commit 2a744db

Please sign in to comment.