Skip to content

Commit

Permalink
fix: use correct integration name
Browse files Browse the repository at this point in the history
  • Loading branch information
j-luong committed Aug 6, 2024
1 parent 580a078 commit 99d94e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.snyk.jenkins.tools.internal;

import io.snyk.jenkins.PluginMetadata;
import io.snyk.jenkins.tools.Platform;

import javax.annotation.Nonnull;
Expand All @@ -14,7 +15,6 @@
public class DownloadService {
private static final String SNYK_DOWNLOAD_PRIMARY = "https://downloads.snyk.io/%s/%s/%s";
private static final String SNYK_DOWNLOAD_SECONDARY = "https://static.snyk.io/%s/%s/%s";
public static final String SNYK_INTEGRATION_NAME = "JENKINS_PLUGIN";
public static final List<String> SNYK_CLI_DOWNLOAD_URLS = Collections.unmodifiableList(Arrays.asList(SNYK_DOWNLOAD_PRIMARY, SNYK_DOWNLOAD_SECONDARY));

private DownloadService() {
Expand All @@ -29,6 +29,6 @@ public static URL constructDownloadUrlForSnyk(@Nonnull String urlTemplate, @Nonn
} else { // snyk-to-html
urlNoUtm = new URL(format(urlTemplate, product, version, platform.snykToHtmlWrapperFileName));
}
return new URL(urlNoUtm.toString() + "?utm_source=" + SNYK_INTEGRATION_NAME);
return new URL(urlNoUtm.toString() + "?utm_source=" + PluginMetadata.getIntegrationName());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.snyk.jenkins.tools.internal;

import io.snyk.jenkins.PluginMetadata;
import org.junit.Test;

import io.snyk.jenkins.tools.Platform;
Expand All @@ -19,7 +20,7 @@ public void constructDownloadUrlForSnyk_shouldReturnExpectedUrlForCli() throws I
String urlTemplate = "https://downloads.snyk.io/%s/%s/%s";
String product = "cli";
String version = "stable";
String queryParam = "?utm_source=" + DownloadService.SNYK_INTEGRATION_NAME;
String queryParam = "?utm_source=" + PluginMetadata.getIntegrationName();
Platform platform = Platform.MAC_OS;

URL expectedUrl = new URL("https://downloads.snyk.io/" + product + "/" + version + "/" + "snyk-macos" + queryParam);
Expand All @@ -34,7 +35,7 @@ public void constructDownloadUrlForSnyk_shouldReturnExpectedUrlForSnykToHtml() t
String urlTemplate = "https://downloads.snyk.io/%s/%s/%s";
String product = "snyk-to-html";
String version = "stable";
String queryParam = "?utm_source=" + DownloadService.SNYK_INTEGRATION_NAME;
String queryParam = "?utm_source=" + PluginMetadata.getIntegrationName();
Platform platform = Platform.MAC_OS;

URL expectedUrl = new URL("https://downloads.snyk.io/" + product + "/" + version + "/" + "snyk-to-html-macos" + queryParam);
Expand Down

0 comments on commit 99d94e0

Please sign in to comment.