Skip to content

Commit baa15e5

Browse files
authored
CM-32305 - Add new SCA flow which decreases execution time (#45)
1 parent 676479d commit baa15e5

File tree

12 files changed

+55
-8
lines changed

12 files changed

+55
-8
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@ jobs:
155155
sudo rm -rf /usr/share/dotnet
156156
sudo rm -rf /usr/local/lib/android
157157
sudo rm -rf /opt/ghc
158+
sudo rm -rf /usr/local/.ghcup
159+
160+
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
161+
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
162+
sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..."
163+
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
164+
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
165+
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
166+
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
167+
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
168+
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
169+
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
170+
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
171+
172+
sudo docker image prune --all --force || true
158173

159174
- name: Fetch Sources
160175
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## [Unreleased]
66

7+
## [1.3.0] - 2024-02-12
8+
9+
- Add new SCA flow which decreases execution time
10+
711
## [1.2.0] - 2024-02-01
812

913
- Add Open-source Threats (SCA) support
@@ -43,6 +47,8 @@
4347

4448
The first public release of the plugin.
4549

50+
[1.3.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.3.0
51+
4652
[1.2.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.2.0
4753

4854
[1.1.5]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.1.5

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.cycode.plugin
44
pluginName = Cycode
55
pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion = 1.2.0
7+
pluginVersion = 1.3.0
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 211.1

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ jackson = "2.15.2"
55

66
# plugins
77
dokka = "1.9.10"
8-
kotlin = "1.8.21"
8+
kotlin = "1.9.20"
99
changelog = "2.2.0"
10-
gradleIntelliJPlugin = "1.16.0"
10+
gradleIntelliJPlugin = "1.17.1"
1111
kover = "0.7.3"
1212

1313
[libraries]

src/main/kotlin/com/cycode/plugin/Consts.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Consts {
2323
val DEFAULT_CLI_PATH = getDefaultCliPath()
2424
const val CLI_GITHUB_ORG = "cycodehq"
2525
const val CLI_GITHUB_REPO = "cycode-cli"
26-
const val CLI_GITHUB_TAG = "v1.7.1"
26+
const val CLI_GITHUB_TAG = "v1.9.0"
2727
const val CLI_CHECK_NEW_VERSION_EVERY_SEC = 24 * 60 * 60 // 24 hours
2828
const val PLUGIN_AUTO_SAVE_FLUSH_INITIAL_DELAY_SEC = 0L
2929
const val PLUGIN_AUTO_SAVE_FLUSH_DELAY_SEC = 5L

src/main/kotlin/com/cycode/plugin/components/settingsWindow/SettingsWindow.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class SettingsWindow {
2020

2121
private var scanOnSaveCheckbox = JBCheckBox(null, pluginSettings.scanOnSave)
2222

23+
private var scaSyncFlowCheckbox = JBCheckBox(null, pluginSettings.scaSyncFlow)
24+
2325
fun getComponent(): DialogPanel {
2426
val contentPanel = panel {
2527
titledRow(CycodeBundle.message("settingsCliSectionTitle")) {
@@ -58,6 +60,13 @@ class SettingsWindow {
5860
}
5961
}
6062
}
63+
titledRow(CycodeBundle.message("settingsExperimentalSectionTitle")) {
64+
row(label = CycodeBundle.message("settingsScaSyncFlowCheckbox")) {
65+
cell {
66+
scaSyncFlowCheckbox()
67+
}
68+
}
69+
}
6170
}
6271

6372
return contentPanel
@@ -71,10 +80,11 @@ class SettingsWindow {
7180
cliAppUrlTextField.text,
7281
cliAdditionalParamsTextField.text,
7382
scanOnSaveCheckbox.isSelected,
83+
scaSyncFlowCheckbox.isSelected,
7484
)
7585
}
7686

7787
companion object {
78-
const val FIELD_COLUMNS_COUNT = 40 // max on the smallest settings window
88+
const val FIELD_COLUMNS_COUNT = 35 // max on the smallest settings window
7989
}
8090
}

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/scanContentTab/ScanContentTab.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.cycode.plugin.components.toolWindow.components.scanContentTab
22

3-
import com.cycode.plugin.Consts
43
import com.cycode.plugin.CycodeBundle
54
import com.cycode.plugin.components.Component
65
import com.cycode.plugin.components.common.BorderedPanel

src/main/kotlin/com/cycode/plugin/services/CliService.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ class CliService(private val project: Project) {
155155
}
156156
}
157157

158+
private fun getCliScanOptions(scanType: CliScanType): Array<String> {
159+
val options = mutableListOf<String>()
160+
if (scanType == CliScanType.Sca && pluginSettings.scaSyncFlow) {
161+
options.add("--sync")
162+
options.add("--no-restore")
163+
}
164+
return options.toTypedArray()
165+
}
166+
158167
private inline fun <reified T> scanPaths(
159168
paths: List<String>,
160169
scanType: CliScanType,
@@ -166,6 +175,7 @@ class CliService(private val project: Project) {
166175
"scan",
167176
"-t",
168177
scanTypeString,
178+
*getCliScanOptions(scanType),
169179
"path",
170180
*getPathsAsArguments(paths),
171181
cancelledCallback = cancelledCallback

src/main/kotlin/com/cycode/plugin/services/CycodePersistentSettingsService.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class CycodePersistentSettingsService : PersistentStateComponent<CycodePersisten
2020

2121
var scanOnSave: Boolean = true
2222

23+
var scaSyncFlow: Boolean = true
24+
2325
override fun getState(): CycodePersistentSettingsService {
2426
return this
2527
}
@@ -36,6 +38,7 @@ class CycodePersistentSettingsService : PersistentStateComponent<CycodePersisten
3638
cliAppUrl,
3739
cliAdditionalParams,
3840
scanOnSave,
41+
scaSyncFlow,
3942
)
4043
}
4144
}

src/main/kotlin/com/cycode/plugin/settings/ApplicationSettingsConfigurable.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ class ApplicationSettingsConfigurable(val project: Project) : SearchableConfigur
5555
val newSettings = settingsWindows.getSettings()
5656

5757
pluginSettings.cliAutoManaged = newSettings.cliAutoManaged
58-
pluginSettings.scanOnSave = newSettings.scanOnSave
5958
pluginSettings.cliAdditionalParams = newSettings.cliAdditionalParams
59+
pluginSettings.scanOnSave = newSettings.scanOnSave
60+
pluginSettings.scaSyncFlow = newSettings.scaSyncFlow
6061

6162
if (isValidCliPath(newSettings.cliPath)) {
6263
pluginSettings.cliPath = newSettings.cliPath

0 commit comments

Comments
 (0)