Skip to content

Commit 4fe53d2

Browse files
authored
ci: include lts releases in pr and main builds (#335)
1 parent b2634e9 commit 4fe53d2

File tree

3 files changed

+84
-68
lines changed

3 files changed

+84
-68
lines changed

.teamcity/builds/Build.kt

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package builds
22

33
import jetbrains.buildServer.configs.kotlin.BuildType
44
import jetbrains.buildServer.configs.kotlin.Project
5+
import jetbrains.buildServer.configs.kotlin.ReuseBuilds
6+
import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications
57
import jetbrains.buildServer.configs.kotlin.sequential
68
import jetbrains.buildServer.configs.kotlin.toId
79

@@ -16,13 +18,11 @@ enum class JavaPlatform(
1618
JDK_17(JavaVersion.V_17, platformITVersions = listOf("7.7.0"))
1719
}
1820

19-
val DEFAULT_NEO4J_VERSION = Neo4jVersion.V_2025
20-
2121
class Build(
2222
name: String,
2323
forPullRequests: Boolean,
24+
neo4jVersions: Set<Neo4jVersion>,
2425
forCompatibility: Boolean = false,
25-
neo4jVersion: Neo4jVersion = DEFAULT_NEO4J_VERSION,
2626
customizeCompletion: BuildType.() -> Unit = {}
2727
) :
2828
Project(
@@ -59,46 +59,55 @@ class Build(
5959
Neo4jVersion.V_NONE,
6060
),
6161
)
62-
dependentBuildType(
63-
Maven(
64-
"${name}-unit-tests-${java.javaVersion.version}",
65-
"unit tests (${java.javaVersion.version})",
66-
"test",
67-
java.javaVersion,
68-
neo4jVersion,
69-
),
70-
)
62+
7163
dependentBuildType(collectArtifacts(packaging))
7264

7365
parallel {
74-
java.platformITVersions.forEach { confluentPlatformVersion ->
75-
dependentBuildType(
76-
IntegrationTests(
77-
"${name}-integration-tests-${java.javaVersion.version}-${confluentPlatformVersion}-${neo4jVersion.version}",
78-
"integration tests (${java.javaVersion.version}, ${confluentPlatformVersion}, ${neo4jVersion.version})",
79-
java.javaVersion,
80-
confluentPlatformVersion,
81-
neo4jVersion,
82-
) {
83-
dependencies {
84-
artifacts(packaging) {
85-
artifactRules =
86-
"""
66+
neo4jVersions.forEach { neo4jVersion ->
67+
sequential {
68+
dependentBuildType(
69+
Maven(
70+
"${name}-unit-tests-${java.javaVersion.version}-${neo4jVersion.version}",
71+
"unit tests (${java.javaVersion.version}, ${neo4jVersion.version})",
72+
"test",
73+
java.javaVersion,
74+
neo4jVersion,
75+
),
76+
)
77+
78+
parallel {
79+
java.platformITVersions.forEach { confluentPlatformVersion ->
80+
dependentBuildType(
81+
IntegrationTests(
82+
"${name}-integration-tests-${java.javaVersion.version}-${confluentPlatformVersion}-${neo4jVersion.version}",
83+
"integration tests (${java.javaVersion.version}, ${confluentPlatformVersion}, ${neo4jVersion.version})",
84+
java.javaVersion,
85+
confluentPlatformVersion,
86+
neo4jVersion,
87+
) {
88+
dependencies {
89+
artifacts(packaging) {
90+
artifactRules =
91+
"""
8792
+:packages/*.jar => docker/plugins
8893
-:packages/*-kc-oss.jar
8994
"""
90-
.trimIndent()
91-
}
92-
}
93-
},
94-
)
95+
.trimIndent()
96+
}
97+
}
98+
},
99+
)
100+
}
101+
}
102+
}
95103
}
96104
}
97105
}
98106
}
99107
}
100108

101-
dependentBuildType(complete)
109+
dependentBuildType(
110+
complete, reuse = if (forCompatibility) ReuseBuilds.NO else ReuseBuilds.SUCCESSFUL)
102111
if (!forPullRequests && !forCompatibility)
103112
dependentBuildType(Release("${name}-release", "release", DEFAULT_JAVA_VERSION))
104113
}
@@ -116,6 +125,26 @@ class Build(
116125
buildType(it)
117126
}
118127

128+
if (!forPullRequests) {
129+
complete.features {
130+
notifications {
131+
buildFailedToStart = true
132+
buildFailed = true
133+
firstFailureAfterSuccess = true
134+
firstSuccessAfterFailure = true
135+
buildProbablyHanging = true
136+
137+
branchFilter = "+:main"
138+
139+
notifierSettings = slackNotifier {
140+
connection = SLACK_CONNECTION_ID
141+
sendTo = SLACK_CHANNEL
142+
messageFormat = simpleMessageFormat()
143+
}
144+
}
145+
}
146+
}
147+
119148
complete.apply(customizeCompletion)
120149
},
121150
)

.teamcity/builds/Common.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import jetbrains.buildServer.configs.kotlin.BuildType
66
import jetbrains.buildServer.configs.kotlin.CompoundStage
77
import jetbrains.buildServer.configs.kotlin.FailureAction
88
import jetbrains.buildServer.configs.kotlin.Requirements
9+
import jetbrains.buildServer.configs.kotlin.ReuseBuilds
910
import jetbrains.buildServer.configs.kotlin.buildFeatures.PullRequests
1011
import jetbrains.buildServer.configs.kotlin.buildFeatures.commitStatusPublisher
1112
import jetbrains.buildServer.configs.kotlin.buildFeatures.dockerRegistryConnections
@@ -27,7 +28,7 @@ const val DEFAULT_CONFLUENT_PLATFORM_VERSION = "7.2.9"
2728

2829
// Look into Root Project's settings -> Connections
2930
const val SLACK_CONNECTION_ID = "PROJECT_EXT_83"
30-
const val SLACK_CHANNEL = "#C05R4RURYLA" // #team-connectors-feed
31+
const val SLACK_CHANNEL = "#team-connectors-feed"
3132

3233
// Look into Root Project's settings -> Connections
3334
const val ECR_CONNECTION_ID = "PROJECT_EXT_124"
@@ -108,10 +109,11 @@ fun BuildFeatures.loginToECR() = dockerRegistryConnections {
108109
loginToRegistry = on { dockerRegistryId = ECR_CONNECTION_ID }
109110
}
110111

111-
fun CompoundStage.dependentBuildType(bt: BuildType) =
112+
fun CompoundStage.dependentBuildType(bt: BuildType, reuse: ReuseBuilds = ReuseBuilds.SUCCESSFUL) =
112113
buildType(bt) {
113114
onDependencyCancel = FailureAction.CANCEL
114115
onDependencyFailure = FailureAction.FAIL_TO_START
116+
reuseBuilds = reuse
115117
}
116118

117119
fun collectArtifacts(buildType: BuildType): BuildType {

.teamcity/settings.kts

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import builds.Build
22
import builds.Neo4jKafkaConnectorVcs
33
import builds.Neo4jVersion
4-
import builds.SLACK_CHANNEL
5-
import builds.SLACK_CONNECTION_ID
64
import jetbrains.buildServer.configs.kotlin.Project
7-
import jetbrains.buildServer.configs.kotlin.buildFeatures.notifications
85
import jetbrains.buildServer.configs.kotlin.project
96
import jetbrains.buildServer.configs.kotlin.triggers.schedule
107
import jetbrains.buildServer.configs.kotlin.triggers.vcs
@@ -21,24 +18,30 @@ project {
2118
vcsRoot(Neo4jKafkaConnectorVcs)
2219

2320
subProject(
24-
Build(name = "main", forPullRequests = false) {
25-
triggers {
26-
vcs {
27-
this.branchFilter = "+:main"
28-
this.triggerRules =
29-
"""
21+
Build(
22+
name = "main",
23+
neo4jVersions = setOf(Neo4jVersion.V_4_4, Neo4jVersion.V_5, Neo4jVersion.V_2025),
24+
forPullRequests = false) {
25+
triggers {
26+
vcs {
27+
this.branchFilter = "+:main"
28+
this.triggerRules =
29+
"""
3030
-:comment=^build.*release version.*:**
3131
-:comment=^build.*update version.*:**
3232
"""
33-
.trimIndent()
34-
}
35-
}
36-
})
33+
.trimIndent()
34+
}
35+
}
36+
})
3737

3838
subProject(
39-
Build(name = "pull-request", forPullRequests = true) {
40-
triggers { vcs { this.branchFilter = "+:pull/*" } }
41-
})
39+
Build(
40+
name = "pull-request",
41+
neo4jVersions = setOf(Neo4jVersion.V_4_4, Neo4jVersion.V_5, Neo4jVersion.V_2025),
42+
forPullRequests = true) {
43+
triggers { vcs { this.branchFilter = "+:pull/*" } }
44+
})
4245

4346
subProject(
4447
Project {
@@ -51,7 +54,7 @@ project {
5154
name = "${neo4j.version}",
5255
forPullRequests = false,
5356
forCompatibility = true,
54-
neo4jVersion = neo4j) {
57+
neo4jVersions = setOf(neo4j)) {
5558
triggers {
5659
vcs { enabled = false }
5760

@@ -64,24 +67,6 @@ project {
6467
triggerBuild = always()
6568
}
6669
}
67-
68-
features {
69-
notifications {
70-
buildFailedToStart = true
71-
buildFailed = true
72-
firstFailureAfterSuccess = true
73-
firstSuccessAfterFailure = true
74-
buildProbablyHanging = true
75-
76-
branchFilter = "+:main"
77-
78-
notifierSettings = slackNotifier {
79-
connection = SLACK_CONNECTION_ID
80-
sendTo = SLACK_CHANNEL
81-
messageFormat = simpleMessageFormat()
82-
}
83-
}
84-
}
8570
})
8671
}
8772
})

0 commit comments

Comments
 (0)