diff --git a/package.json b/package.json index 0f021e97..9c5565df 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,12 @@ "configuration": { "title": "JFrog", "properties": { + "jfrog.useSpecificScannersVersion": { + "type": "string", + "scope": "application", + "pattern": "^$|^\\d+\\.\\d+\\.\\d+$", + "markdownDescription": "Specifies the JFrog Scanners version to use. (format X.X.X). By default the latest scanners version is used." + }, "jfrog.xray.exclusions": { "type": "string", "default": "**/*{.git,test,venv,node_modules,target}*", diff --git a/src/main/scanLogic/scanRunners/analyzerManager.ts b/src/main/scanLogic/scanRunners/analyzerManager.ts index b3c3b571..ed3b25cb 100644 --- a/src/main/scanLogic/scanRunners/analyzerManager.ts +++ b/src/main/scanLogic/scanRunners/analyzerManager.ts @@ -15,14 +15,11 @@ import { LogUtils } from '../../log/logUtils'; * Analyzer manager is responsible for running the analyzer on the workspace. */ export class AnalyzerManager { - private static readonly RELATIVE_DOWNLOAD_URL: string = '/xsc-gen-exe-analyzer-manager-local/v1/[RELEASE]'; + private static readonly RELATIVE_DOWNLOAD_URL: string = '/xsc-gen-exe-analyzer-manager-local/v1'; private static readonly BINARY_NAME: string = 'analyzerManager'; public static readonly ANALYZER_MANAGER_PATH: string = Utils.addWinSuffixIfNeeded( path.join(ScanUtils.getIssuesPath(), AnalyzerManager.BINARY_NAME, AnalyzerManager.BINARY_NAME) ); - private static readonly DOWNLOAD_URL: string = Utils.addZipSuffix( - AnalyzerManager.RELATIVE_DOWNLOAD_URL + '/' + Utils.getPlatformAndArch() + '/' + AnalyzerManager.BINARY_NAME - ); private static readonly JFROG_RELEASES_URL: string = 'https://releases.jfrog.io'; public static readonly JF_RELEASES_REPO: string = 'JF_RELEASES_REPO'; @@ -41,10 +38,22 @@ export class AnalyzerManager { private static FINISH_UPDATE_PROMISE: Promise; constructor(private _connectionManager: ConnectionManager, protected _logManager: LogManager) { - this._binary = new Resource(AnalyzerManager.DOWNLOAD_URL, AnalyzerManager.ANALYZER_MANAGER_PATH, _logManager, this.createJFrogCLient()); + this._binary = new Resource(AnalyzerManager.getDownloadUrl(), AnalyzerManager.ANALYZER_MANAGER_PATH, _logManager, this.createJFrogCLient()); AnalyzerManager.FINISH_UPDATE_PROMISE = this.checkForUpdates(); } + private static getDownloadUrl(): string { + return Utils.addZipSuffix( + AnalyzerManager.RELATIVE_DOWNLOAD_URL + + '/' + + Configuration.getAnalyzerManagerVersion() + + '/' + + Utils.getPlatformAndArch() + + '/' + + AnalyzerManager.BINARY_NAME + ); + } + private createJFrogCLient(): JfrogClient { const releasesRepo: JfrogClient | undefined = this.getExternalResourcesRepository(); if (!releasesRepo) { diff --git a/src/main/utils/configuration.ts b/src/main/utils/configuration.ts index b31e913f..4e3adc32 100644 --- a/src/main/utils/configuration.ts +++ b/src/main/utils/configuration.ts @@ -65,6 +65,14 @@ export class Configuration { return vscode.workspace.getConfiguration(this.jfrogSectionConfigurationKey).get('showAdvanceScanLog', false); } + public static getAnalyzerManagerVersion(): string { + let version: string = vscode.workspace.getConfiguration(this.jfrogSectionConfigurationKey).get('useSpecificScannersVersion', ''); + if (version === '') { + version = '[RELEASE]'; + } + return version; + } + /** * @returns the log level */