Skip to content

Commit

Permalink
chore: LS bump protocol version to 11 [IDE-236] (#506)
Browse files Browse the repository at this point in the history
* feat: download CLI version according to supported protocol version [IDE-157]

* fix: tests (wip)

* fix: added forced silent update for mismatched protocol versions

* fix: remove unnecessary suppressions/imports

* chore: bump required protocol version, fix small code quality issue

* docs: update CHANGELOG.md

* fix: merge error
  • Loading branch information
bastiandoetsch committed Apr 9, 2024
1 parent 54a6829 commit 5b4745f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v2

test:
name: Test
Expand All @@ -25,16 +25,16 @@ jobs:

steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

- name: Setup Gradle Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand All @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Snyk
uses: snyk/actions/setup@0.4.0
Expand All @@ -73,18 +73,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

# PluginVerifier has been compiled by a more recent version of the Java - Java 11.
# That's why, we are using not version 8 here, but 11.
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

- name: Setup Gradle Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

- name: Setup Gradle Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
name: Setup Java
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

- name: Setup Gradle Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
## [2.7.14]
### Added
- force download of compatible CLI on mismatched LS protocol versions
- bumped LS protocol version to ensure built-in LS in CLI has necessary commands for global ignores

## [2.7.13]
### Added
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ai/deepcode/javaclient/DeepCodeRestApiImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ai.deepcode.javaclient.responses.CreateBundleResponse;
import ai.deepcode.javaclient.responses.GetAnalysisResponse;
import ai.deepcode.javaclient.responses.GetFiltersResponse;
import com.intellij.openapi.diagnostic.Logger;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -42,6 +43,7 @@
public class DeepCodeRestApiImpl implements DeepCodeRestApi {

public static final String API_URL = "https://deeproxy.snyk.io/";
public static final @NotNull Logger LOGGER = Logger.getInstance(DeepCodeRestApiImpl.class);

private static Retrofit retrofit = buildRetrofit(API_URL, false, false);

Expand Down Expand Up @@ -79,9 +81,7 @@ private static Retrofit buildRetrofit(
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
builder.sslSocketFactory(sslSocketFactory, x509TrustManager);
} catch (NoSuchAlgorithmException | KeyManagementException e) {
// TODO(pavel): extract Retrofit and OkHttpClient into configuration object to simplify API
// client building.
e.printStackTrace();
LOGGER.warn("Failed to disable SSL verification. Check your JDK", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import java.util.UUID
)
class SnykApplicationSettingsStateService : PersistentStateComponent<SnykApplicationSettingsStateService> {

var currentLSProtocolVersion: Int? = 0
val requiredLsProtocolVersion = 10
val requiredLsProtocolVersion = 11

var currentLSProtocolVersion: Int? = 0
var isGlobalIgnoresFeatureEnabled = false
var cliBaseDownloadURL: String = "https://static.snyk.io"
var cliPath: String = getPluginPath() + separator + Platform.current().snykWrapperFileName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class CliDownloaderTest {
CliDownloader.LATEST_RELEASES_URL
)
}

@Test
fun `should not delete file if checksum verification fails`() {
val testFile = Files.createTempFile("test", "test").toFile()
Expand Down

0 comments on commit 5b4745f

Please sign in to comment.