Skip to content

Commit

Permalink
Fix compatibility with 2021.2+ (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Oct 26, 2021
1 parent 8e47d0a commit b791bbd
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ teamcity {
useSeparateClassloader = true

if (project.name == "serverPre2018.2") {
maximumBuild = "59999"
maximumBuild = "58744"
} else {
allowRuntimeReload = true
minimumBuild = "60000"
minimumBuild = "60925"
}

dependencies {
Expand Down
30 changes: 30 additions & 0 deletions buildSrc/src/main/kotlin/net/kautler/teamcity.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ teamcity {

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

environments.register("teamcity2021.1") {
version = versions["teamcity2021.1Test"]
val serverPlugin by project(":server").tasks.existing
plugins(serverPlugin)
}

environments.register("teamcity2020.2") {
version = versions["teamcity2020.2Test"]
val serverPlugin by project(":server").tasks.existing
plugins(serverPlugin)
}

environments.register("teamcity2020.1") {
version = versions["teamcity2020.1Test"]
val serverPlugin by project(":server").tasks.existing
plugins(serverPlugin)
}

environments.register("teamcity2019.2") {
version = versions["teamcity2019.2Test"]
val serverPlugin by project(":server").tasks.existing
plugins(serverPlugin)
}

environments.register("teamcity2019.1") {
version = versions["teamcity2019.1Test"]
val serverPlugin by project(":server").tasks.existing
plugins(serverPlugin)
}

environments.register("teamcity2018.2") {
version = versions["teamcity2018.2Test"]
val serverPlugin by project(":server").tasks.existing
Expand Down
9 changes: 7 additions & 2 deletions buildSrc/src/main/kotlin/net/kautler/versions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ repositories {

val versions by extra(mapOf(
// production versions
"teamcity" to "2019.1",
"teamcityTest" to "2019.1",
"teamcity" to "2020.1.1",
"teamcityTest" to "2021.2",
"teamcity2021.1Test" to "2021.1.4",
"teamcity2020.2Test" to "2020.2.4",
"teamcity2020.1Test" to "2020.1.5",
"teamcity2019.2Test" to "2019.2.4",
"teamcity2019.1Test" to "2019.1.5",
"teamcity2018.2Test" to "2018.2.4",
"teamcity2018.1" to "2018.1.2",
"teamcity2018.1Test" to "2018.1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Constants {
public static final String SSH_EXECUTABLE_REQUIREMENT_ID = SSH_EXECUTABLE_CONFIGURATION_PARAMETER_NAME + "-exists";

public static final BigInteger MAX_PORT_NUMBER = BigInteger.valueOf(65_535);
public static final int MIN_VERSION_SUPPORTING_BUILD_FEATURE_REQUIREMENTS = 65_000;
public static final int MIN_VERSION_SUPPORTING_BUILD_FEATURE_REQUIREMENTS = 65_998;

public static final List<String> VALID_PROPERTY_NAMES = asList(
SSH_TUNNEL_REQUIREMENT_PROPERTY_NAME, NAME_PROPERTY_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

import jetbrains.buildServer.serverSide.ProjectManager;
import jetbrains.buildServer.serverSide.SBuildServer;
import jetbrains.buildServer.ssh.SecureServerSshKeyManager;
import jetbrains.buildServer.ssh.ServerSshKeyManager;
import jetbrains.buildServer.ssh.TeamCitySshKey;
import jetbrains.buildServer.util.MultiMap;
import net.kautler.teamcity.ssh_tunnel.common.Constants;
import net.kautler.teamcity.ssh_tunnel.common.ParametersHelper;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.ApplicationContext;

import java.util.List;
import java.util.Map;
Expand All @@ -44,12 +43,20 @@ public class ServerParametersHelper extends ParametersHelper {
@NotNull
private final SBuildServer buildServer;

@SuppressWarnings("unchecked")
public ServerParametersHelper(@NotNull ProjectManager projectManager,
@NotNull SecureServerSshKeyManager sshKeyManager,
@NotNull ApplicationContext applicationContext,
@NotNull SBuildServer buildServer) {
this.projectManager = projectManager;
this.sshKeyManager = sshKeyManager;
this.buildServer = buildServer;
Class<? extends ServerSshKeyManager> serverSshKeyManagerClass;
try {
serverSshKeyManagerClass = (Class<? extends ServerSshKeyManager>) Class.forName("jetbrains.buildServer.ssh.SecureServerSshKeyManager");
} catch (ClassNotFoundException e) {
serverSshKeyManagerClass = ServerSshKeyManager.class;
}
this.sshKeyManager = applicationContext.getBean(serverSshKeyManagerClass);
System.out.println(this.sshKeyManager);
}

@Override
Expand Down

0 comments on commit b791bbd

Please sign in to comment.