Skip to content

Commit b791bbd

Browse files
committed
Fix compatibility with 2021.2+ (#6)
1 parent 8e47d0a commit b791bbd

File tree

5 files changed

+51
-9
lines changed

5 files changed

+51
-9
lines changed

buildSrc/src/main/kotlin/net/kautler/teamcity-server.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ teamcity {
4949
useSeparateClassloader = true
5050

5151
if (project.name == "serverPre2018.2") {
52-
maximumBuild = "59999"
52+
maximumBuild = "58744"
5353
} else {
5454
allowRuntimeReload = true
55-
minimumBuild = "60000"
55+
minimumBuild = "60925"
5656
}
5757

5858
dependencies {

buildSrc/src/main/kotlin/net/kautler/teamcity.gradle.kts

+30
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,36 @@ teamcity {
3737

3838
extra["teamcityHomeDir"] = teamcityEnvironment.homeDir ?: file("${teamcity.environments.baseHomeDir}/Teamcity-${teamcityEnvironment.version}")
3939

40+
environments.register("teamcity2021.1") {
41+
version = versions["teamcity2021.1Test"]
42+
val serverPlugin by project(":server").tasks.existing
43+
plugins(serverPlugin)
44+
}
45+
46+
environments.register("teamcity2020.2") {
47+
version = versions["teamcity2020.2Test"]
48+
val serverPlugin by project(":server").tasks.existing
49+
plugins(serverPlugin)
50+
}
51+
52+
environments.register("teamcity2020.1") {
53+
version = versions["teamcity2020.1Test"]
54+
val serverPlugin by project(":server").tasks.existing
55+
plugins(serverPlugin)
56+
}
57+
58+
environments.register("teamcity2019.2") {
59+
version = versions["teamcity2019.2Test"]
60+
val serverPlugin by project(":server").tasks.existing
61+
plugins(serverPlugin)
62+
}
63+
64+
environments.register("teamcity2019.1") {
65+
version = versions["teamcity2019.1Test"]
66+
val serverPlugin by project(":server").tasks.existing
67+
plugins(serverPlugin)
68+
}
69+
4070
environments.register("teamcity2018.2") {
4171
version = versions["teamcity2018.2Test"]
4272
val serverPlugin by project(":server").tasks.existing

buildSrc/src/main/kotlin/net/kautler/versions.gradle.kts

+7-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ repositories {
4545

4646
val versions by extra(mapOf(
4747
// production versions
48-
"teamcity" to "2019.1",
49-
"teamcityTest" to "2019.1",
48+
"teamcity" to "2020.1.1",
49+
"teamcityTest" to "2021.2",
50+
"teamcity2021.1Test" to "2021.1.4",
51+
"teamcity2020.2Test" to "2020.2.4",
52+
"teamcity2020.1Test" to "2020.1.5",
53+
"teamcity2019.2Test" to "2019.2.4",
54+
"teamcity2019.1Test" to "2019.1.5",
5055
"teamcity2018.2Test" to "2018.2.4",
5156
"teamcity2018.1" to "2018.1.2",
5257
"teamcity2018.1Test" to "2018.1.5",

common/src/main/java/net/kautler/teamcity/ssh_tunnel/common/Constants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class Constants {
4848
public static final String SSH_EXECUTABLE_REQUIREMENT_ID = SSH_EXECUTABLE_CONFIGURATION_PARAMETER_NAME + "-exists";
4949

5050
public static final BigInteger MAX_PORT_NUMBER = BigInteger.valueOf(65_535);
51-
public static final int MIN_VERSION_SUPPORTING_BUILD_FEATURE_REQUIREMENTS = 65_000;
51+
public static final int MIN_VERSION_SUPPORTING_BUILD_FEATURE_REQUIREMENTS = 65_998;
5252

5353
public static final List<String> VALID_PROPERTY_NAMES = asList(
5454
SSH_TUNNEL_REQUIREMENT_PROPERTY_NAME, NAME_PROPERTY_NAME,

commonServer/src/main/java/net/kautler/teamcity/ssh_tunnel/server/common/ServerParametersHelper.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818

1919
import jetbrains.buildServer.serverSide.ProjectManager;
2020
import jetbrains.buildServer.serverSide.SBuildServer;
21-
import jetbrains.buildServer.ssh.SecureServerSshKeyManager;
2221
import jetbrains.buildServer.ssh.ServerSshKeyManager;
2322
import jetbrains.buildServer.ssh.TeamCitySshKey;
2423
import jetbrains.buildServer.util.MultiMap;
25-
import net.kautler.teamcity.ssh_tunnel.common.Constants;
2624
import net.kautler.teamcity.ssh_tunnel.common.ParametersHelper;
2725
import org.jetbrains.annotations.NotNull;
26+
import org.springframework.context.ApplicationContext;
2827

2928
import java.util.List;
3029
import java.util.Map;
@@ -44,12 +43,20 @@ public class ServerParametersHelper extends ParametersHelper {
4443
@NotNull
4544
private final SBuildServer buildServer;
4645

46+
@SuppressWarnings("unchecked")
4747
public ServerParametersHelper(@NotNull ProjectManager projectManager,
48-
@NotNull SecureServerSshKeyManager sshKeyManager,
48+
@NotNull ApplicationContext applicationContext,
4949
@NotNull SBuildServer buildServer) {
5050
this.projectManager = projectManager;
51-
this.sshKeyManager = sshKeyManager;
5251
this.buildServer = buildServer;
52+
Class<? extends ServerSshKeyManager> serverSshKeyManagerClass;
53+
try {
54+
serverSshKeyManagerClass = (Class<? extends ServerSshKeyManager>) Class.forName("jetbrains.buildServer.ssh.SecureServerSshKeyManager");
55+
} catch (ClassNotFoundException e) {
56+
serverSshKeyManagerClass = ServerSshKeyManager.class;
57+
}
58+
this.sshKeyManager = applicationContext.getBean(serverSshKeyManagerClass);
59+
System.out.println(this.sshKeyManager);
5360
}
5461

5562
@Override

0 commit comments

Comments
 (0)