From 39412aad540997a1d29f053f6220d8c22d11b050 Mon Sep 17 00:00:00 2001 From: eyalbe4 Date: Sat, 28 Dec 2024 20:56:53 +0200 Subject: [PATCH] Fix Build-Info URL --- .../teamcity/agent/ArtifactoryAgentLifeCycleAdapter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agent/src/main/java/org/jfrog/teamcity/agent/ArtifactoryAgentLifeCycleAdapter.java b/agent/src/main/java/org/jfrog/teamcity/agent/ArtifactoryAgentLifeCycleAdapter.java index 56be3aa..4ec006d 100644 --- a/agent/src/main/java/org/jfrog/teamcity/agent/ArtifactoryAgentLifeCycleAdapter.java +++ b/agent/src/main/java/org/jfrog/teamcity/agent/ArtifactoryAgentLifeCycleAdapter.java @@ -26,15 +26,17 @@ public void runnerFinished(@NotNull BuildRunnerContext runner, @NotNull BuildFin } private static void addBuildInfoUrlParam(BuildRunnerContext runner) { - String artifactoryUrl = StringUtils.removeEnd((String)runner.getRunnerParameters().get("org.jfrog.artifactory.selectedDeployableServer.url"), "/"); + String artifactoryUrl = StringUtils.removeEnd(runner.getRunnerParameters().get(RunnerParameterKeys.URL), "/"); String buildInfoUrl; if (StringUtils.endsWith(artifactoryUrl, "/artifactory")) { buildInfoUrl = createBuildInfoUrl(StringUtils.removeEnd(artifactoryUrl, "/artifactory"), (String)runner.getRunnerParameters().get("org.jfrog.artifactory.build.name"), runner.getBuild().getBuildNumber(), (String)runner.getRunnerParameters().get("org.jfrog.artifactory.build.timestamp")); } else { - buildInfoUrl = BuildInfoExtractorUtils.createBuildInfoUrl(artifactoryUrl, (String)runner.getRunnerParameters().get("org.jfrog.artifactory.build.name"), runner.getBuild().getBuildNumber(), "", "", false, false); + // Without the platform URL it would work only on Artifactory 6 + buildInfoUrl = BuildInfoExtractorUtils.createBuildInfoUrl(artifactoryUrl, runner.getRunnerParameters().get(BUILD_NAME), + runner.getBuild().getBuildNumber(), "", "", false, false); } - runner.getBuild().addSharedSystemProperty("org.jfrog.artifactory.build.url." + runner.getBuild().getBuildId() + "." + runner.getId(), buildInfoUrl); + runner.getBuild().addSharedSystemProperty(BUILD_URL + "." + runner.getBuild().getBuildId() + "." + runner.getId(), buildInfoUrl); } private static String createBuildInfoUrl(String platformUrl, String buildName, String buildNumber, String timeStamp) {