Skip to content

Add a TeamCity configuration to automatically check if the timezone database or the list of WIndows mappings were updated #513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 75 additions & 1 deletion .teamcity/additionalConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/

import jetbrains.buildServer.configs.kotlin.BuildType
import jetbrains.buildServer.configs.kotlin.DslContext
import jetbrains.buildServer.configs.kotlin.Project
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications
import jetbrains.buildServer.configs.kotlin.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.buildSteps.script
import jetbrains.buildServer.configs.kotlin.toId
import jetbrains.buildServer.configs.kotlin.triggers.schedule
import jetbrains.buildServer.configs.kotlin.vcs.GitVcsRoot

fun Project.additionalConfiguration() {
knownBuilds.buildAll.features {
Expand All @@ -19,4 +26,71 @@ fun Project.additionalConfiguration() {
}
}
}
}

vcsRoot(EggertTzRepo)

BuildType {
id("Check_Updates")
name = "Check for timezone database updates"
description = "Queries the Internet to see if the timezone data was updated"

vcs {
root(DslContext.settingsRoot)
root(EggertTzRepo, "+:. => tz")
}

steps {
script {
name = "Check if a new version of the timezone database is present"
id = "Check_if_a_new_version_of_the_timezone_database_is_present"
scriptContent = """
set -efu
latest_tag=$(git -C tz/ describe --abbrev=0 --tags)
current_tag=$(grep tzdbVersion gradle.properties | cut -d= -f2)
if [ "${'$'}latest_tag" != "${'$'}current_tag" ]; then
printf "A new version of the timezone database is available: %s\n" "${'$'}latest_tag" >&2
exit 1
fi
""".trimIndent()
}
gradle {
name = "Check if the Windows names need updating"
id = "Check_if_the_Windows_names_need_updating"
tasks = "downloadWindowsZonesMapping"
jdkHome = "%env.JDK_18_x64%"
}
}

triggers {
schedule {
schedulingPolicy = daily {
hour = 1
minute = 50
}
triggerBuild = always()
}
}

features {
notifications {
notifierSettings = slackNotifier {
connection = "PROJECT_EXT_51"
sendTo = "UL2TZ4V55" // Dmitry Khalanskiy
messageFormat = simpleMessageFormat()
}
buildFailed = true
firstFailureAfterSuccess = true
}
}

requirements {
doesNotContain("teamcity.agent.jvm.os.name", "Windows")
}
}.also { buildType(it) }
}

object EggertTzRepo : GitVcsRoot({
name = "Timezone database repository"
url = "https://github.com/eggert/tz"
branch = "refs/heads/main"
})
5 changes: 0 additions & 5 deletions core/windows/src/internal/WindowsZoneNames.kt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
"Asia/Brunei" to "Singapore Standard Time",
"Asia/Calcutta" to "India Standard Time",
"Asia/Chita" to "Transbaikal Standard Time",
"Asia/Choibalsan" to "Ulaanbaatar Standard Time",
"Asia/Colombo" to "Sri Lanka Standard Time",
"Asia/Damascus" to "Syria Standard Time",
"Asia/Dhaka" to "Bangladesh Standard Time",
Expand Down Expand Up @@ -311,8 +310,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
"Australia/Melbourne" to "AUS Eastern Standard Time",
"Australia/Perth" to "W. Australia Standard Time",
"Australia/Sydney" to "AUS Eastern Standard Time",
"CST6CDT" to "Central Standard Time",
"EST5EDT" to "Eastern Standard Time",
"Etc/GMT" to "UTC",
"Etc/GMT+1" to "Cape Verde Standard Time",
"Etc/GMT+10" to "Hawaiian Standard Time",
Expand Down Expand Up @@ -410,8 +407,6 @@ internal val standardToWindows: Map<String, String> = mutableMapOf(
"Indian/Mauritius" to "Mauritius Standard Time",
"Indian/Mayotte" to "E. Africa Standard Time",
"Indian/Reunion" to "Mauritius Standard Time",
"MST7MDT" to "Mountain Standard Time",
"PST8PDT" to "Pacific Standard Time",
"Pacific/Apia" to "Samoa Standard Time",
"Pacific/Auckland" to "New Zealand Standard Time",
"Pacific/Bougainville" to "Bougainville Standard Time",
Expand Down