diff --git a/pom.xml b/pom.xml
index 00f934d..076bb3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.saucelabs
ci-sauce
- 2.0-SNAPSHOT
+ 2.1-SNAPSHOT
jar
diff --git a/src/main/java/com/saucelabs/ci/sauceconnect/SauceConnectManager.java b/src/main/java/com/saucelabs/ci/sauceconnect/SauceConnectManager.java
index 447e22a..9aad359 100755
--- a/src/main/java/com/saucelabs/ci/sauceconnect/SauceConnectManager.java
+++ b/src/main/java/com/saucelabs/ci/sauceconnect/SauceConnectManager.java
@@ -139,7 +139,7 @@ public String getDefaultSauceConnectLogDirectory() {
private static final String WINDOWS_TEMP_DIR = System.getProperty("java.io.tmpdir");
- public static final String CURRENT_SC_VERSION = "5.2.1";
+ public static final String CURRENT_SC_VERSION = "5.2.2";
public static final LazyInitializer LATEST_SC_VERSION = new Builder, String>()
.setInitializer(SauceConnectManager::getLatestSauceConnectVersion)
.get();
@@ -308,10 +308,30 @@ public void setCleanUpOnExit(boolean cleanUpOnExit) {
public static String getLatestSauceConnectVersion() {
try {
- URI url = URI.create("https://saucelabs.com/versions.json");
+ OperatingSystem operatingSystem = OperatingSystem.getOperatingSystem();
+ String os = System.getProperty("os.name").toLowerCase();
+ String arch = System.getProperty("os.arch").toLowerCase();
+
+ String query;
+
+ if (operatingSystem.isArm(arch)) {
+ query = "arch=arm64&";
+ } else {
+ query = "arch=x86_64&";
+ }
+
+ if (operatingSystem.isWindows(os)) {
+ query += "os=windows";
+ } else if (operatingSystem.isMac(os)) {
+ query += "os=macos";
+ } else {
+ query += "os=linux";
+ }
+
+ URI url = URI.create("https://api.us-west-1.saucelabs.com/rest/v1/public/tunnels/sauce-connect/download?" + query);
HttpRequest request = HttpRequest.newBuilder(url).build();
String versionsJson = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()).body();
- return new JSONObject(versionsJson).getJSONObject("Sauce Connect").getString("version");
+ return new JSONObject(versionsJson).getJSONObject("download").getString("version");
} catch (IOException | InterruptedException e) {
return null;
}
diff --git a/src/main/resources/sauce-connect-5.2.1_darwin.all.zip b/src/main/resources/sauce-connect-5.2.2_darwin.all.zip
similarity index 73%
rename from src/main/resources/sauce-connect-5.2.1_darwin.all.zip
rename to src/main/resources/sauce-connect-5.2.2_darwin.all.zip
index db4d7ad..4d855dc 100644
Binary files a/src/main/resources/sauce-connect-5.2.1_darwin.all.zip and b/src/main/resources/sauce-connect-5.2.2_darwin.all.zip differ
diff --git a/src/main/resources/sauce-connect-5.2.1_linux.aarch64.tar.gz b/src/main/resources/sauce-connect-5.2.2_linux.aarch64.tar.gz
similarity index 62%
rename from src/main/resources/sauce-connect-5.2.1_linux.aarch64.tar.gz
rename to src/main/resources/sauce-connect-5.2.2_linux.aarch64.tar.gz
index 3aca34f..2be9b4e 100644
Binary files a/src/main/resources/sauce-connect-5.2.1_linux.aarch64.tar.gz and b/src/main/resources/sauce-connect-5.2.2_linux.aarch64.tar.gz differ
diff --git a/src/main/resources/sauce-connect-5.2.1_linux.x86_64.tar.gz b/src/main/resources/sauce-connect-5.2.2_linux.x86_64.tar.gz
similarity index 63%
rename from src/main/resources/sauce-connect-5.2.1_linux.x86_64.tar.gz
rename to src/main/resources/sauce-connect-5.2.2_linux.x86_64.tar.gz
index e6fe01f..219eaf8 100644
Binary files a/src/main/resources/sauce-connect-5.2.1_linux.x86_64.tar.gz and b/src/main/resources/sauce-connect-5.2.2_linux.x86_64.tar.gz differ
diff --git a/src/main/resources/sauce-connect-5.2.1_windows.aarch64.zip b/src/main/resources/sauce-connect-5.2.2_windows.aarch64.zip
similarity index 62%
rename from src/main/resources/sauce-connect-5.2.1_windows.aarch64.zip
rename to src/main/resources/sauce-connect-5.2.2_windows.aarch64.zip
index c190b57..77c4ccc 100644
Binary files a/src/main/resources/sauce-connect-5.2.1_windows.aarch64.zip and b/src/main/resources/sauce-connect-5.2.2_windows.aarch64.zip differ
diff --git a/src/main/resources/sauce-connect-5.2.1_windows.x86_64.zip b/src/main/resources/sauce-connect-5.2.2_windows.x86_64.zip
similarity index 63%
rename from src/main/resources/sauce-connect-5.2.1_windows.x86_64.zip
rename to src/main/resources/sauce-connect-5.2.2_windows.x86_64.zip
index f776e64..1b34815 100644
Binary files a/src/main/resources/sauce-connect-5.2.1_windows.x86_64.zip and b/src/main/resources/sauce-connect-5.2.2_windows.x86_64.zip differ
diff --git a/src/test/java/com/saucelabs/ci/sauceconnect/SauceConnectManagerTest.java b/src/test/java/com/saucelabs/ci/sauceconnect/SauceConnectManagerTest.java
index 142333b..53163cc 100755
--- a/src/test/java/com/saucelabs/ci/sauceconnect/SauceConnectManagerTest.java
+++ b/src/test/java/com/saucelabs/ci/sauceconnect/SauceConnectManagerTest.java
@@ -395,7 +395,7 @@ void shouldInitLatestVersionLazilyAndOnce() throws IOException, InterruptedExcep
HttpClient httpClient = mock();
HttpResponse httpResponse = mock();
String version = "5.99.99";
- when(httpResponse.body()).thenReturn("{\"Sauce Connect\": {\"version\": \"" + version + "\"}}");
+ when(httpResponse.body()).thenReturn("{\"download\": {\"version\": \"" + version + "\"}}");
when(httpClient.send(any(), argThat((ArgumentMatcher>) argument -> true))).thenReturn(
httpResponse);
httpClientStaticMock.when(HttpClient::newHttpClient).thenReturn(httpClient);