From f3603d1ddf4c2d376c9afdac854c391cc8e6b656 Mon Sep 17 00:00:00 2001 From: Ilona Shishov Date: Thu, 21 Mar 2024 12:39:36 +0200 Subject: [PATCH] chore: add useGoMVS, enablePythonBestEffortsInstallation and usePipDepTree settings (#247) Signed-off-by: Ilona Shishov --- package-lock.json | 8 ++++---- package.json | 2 +- src/componentAnalysis.ts | 5 ++++- src/config.ts | 15 ++++++++++++--- test/config.test.ts | 25 ++++++++++++++++++++----- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0a17e47b..b33956c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.9.4-ea.5", "license": "Apache-2.0", "dependencies": { - "@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.25", + "@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.26", "@xml-tools/ast": "^5.0.5", "@xml-tools/parser": "^1.0.11", "json-to-ast": "^2.1.0", @@ -837,9 +837,9 @@ } }, "node_modules/@RHEcosystemAppEng/exhort-javascript-api": { - "version": "0.1.1-ea.25", - "resolved": "https://npm.pkg.github.com/download/@RHEcosystemAppEng/exhort-javascript-api/0.1.1-ea.25/dc0203a98eaa207077dd60bac09b3a3e92aa040c", - "integrity": "sha512-rnS1lt2pGs3dw/tECw8Z1J8IrQMuLt4GXexeiwDUThURdkEa+f9k9QU+YO8fB078SVfJarufQAO0wEMdXI5DcA==", + "version": "0.1.1-ea.26", + "resolved": "https://npm.pkg.github.com/download/@RHEcosystemAppEng/exhort-javascript-api/0.1.1-ea.26/883fb514fb41a6e1f52e426e1ed1d9c8fae26eed", + "integrity": "sha512-2QORNJ4vrYWyIgKai09HQs+AM9s9JCuJffrGB6CT9OnY7L+I4LT+YN6iHIo0rvoaQR4MfQl4OmXfHij1HuQ8VQ==", "license": "Apache-2.0", "dependencies": { "@babel/core": "^7.23.2", diff --git a/package.json b/package.json index bf9fdb4d..2012d8b2 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "dist" ], "dependencies": { - "@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.25", + "@RHEcosystemAppEng/exhort-javascript-api": "^0.1.1-ea.26", "@xml-tools/ast": "^5.0.5", "@xml-tools/parser": "^1.0.11", "json-to-ast": "^2.1.0", diff --git a/src/componentAnalysis.ts b/src/componentAnalysis.ts index b280e688..2521ca7b 100644 --- a/src/componentAnalysis.ts +++ b/src/componentAnalysis.ts @@ -165,7 +165,10 @@ async function executeComponentAnalysis (diagnosticFilePath: string, contents: s 'RHDA_TOKEN': globalConfig.telemetryId, 'RHDA_SOURCE': globalConfig.utmSource, 'MATCH_MANIFEST_VERSIONS': globalConfig.matchManifestVersions, - 'EXHORT_PYTHON_VIRTUAL_ENV': globalConfig.setPythonVirtualEnvironment, + 'EXHORT_PYTHON_VIRTUAL_ENV': globalConfig.usePythonVirtualEnvironment, + 'EXHORT_GO_MVS_LOGIC_ENABLED': globalConfig.useGoMVS, + 'EXHORT_PYTHON_INSTALL_BEST_EFFORTS': globalConfig.enablePythonBestEffortsInstallation, + 'EXHORT_PIP_USE_DEP_TREE': globalConfig.usePipDepTree, 'EXHORT_MVN_PATH': globalConfig.exhortMvnPath, 'EXHORT_NPM_PATH': globalConfig.exhortNpmPath, 'EXHORT_GO_PATH': globalConfig.exhortGoPath, diff --git a/src/config.ts b/src/config.ts index b72f0f86..14e46a8e 100644 --- a/src/config.ts +++ b/src/config.ts @@ -16,7 +16,10 @@ class Config utmSource: string; exhortSnykToken: string; matchManifestVersions: string; - setPythonVirtualEnvironment: string; + usePythonVirtualEnvironment: string; + useGoMVS: string; + enablePythonBestEffortsInstallation: string; + usePipDepTree: string; vulnerabilityAlertSeverity: string; exhortMvnPath: string; exhortNpmPath: string; @@ -40,7 +43,10 @@ class Config this.utmSource = process.env.VSCEXT_UTM_SOURCE || ''; this.exhortSnykToken = process.env.VSCEXT_EXHORT_SNYK_TOKEN || ''; this.matchManifestVersions = process.env.VSCEXT_MATCH_MANIFEST_VERSIONS || 'true'; - this.setPythonVirtualEnvironment = process.env.VSCEXT_SET_PYTHON_VIRTUAL_ENVIRONMENT || 'false'; + this.usePythonVirtualEnvironment = process.env.VSCEXT_USE_PYTHON_VIRTUAL_ENVIRONMENT || 'false'; + this.useGoMVS = process.env.VSCEXT_USE_GO_MVS || 'false'; + this.enablePythonBestEffortsInstallation = process.env.VSCEXT_ENABLE_PYTHON_BEST_EFFORTS_INSTALLATION || 'false'; + this.usePipDepTree = process.env.VSCEXT_USE_PIP_DEP_TREE || 'false'; this.vulnerabilityAlertSeverity = process.env.VSCEXT_VULNERABILITY_ALERT_SEVERITY || 'Error'; this.exhortMvnPath = process.env.VSCEXT_EXHORT_MVN_PATH || 'mvn'; this.exhortNpmPath = process.env.VSCEXT_EXHORT_NPM_PATH || 'npm'; @@ -57,7 +63,10 @@ class Config */ updateConfig( rhdaData: any ) { this.matchManifestVersions = rhdaData.matchManifestVersions ? 'true' : 'false'; - this.setPythonVirtualEnvironment = rhdaData.setPythonVirtualEnvironment ? 'true' : 'false'; + this.usePythonVirtualEnvironment = rhdaData.usePythonVirtualEnvironment ? 'true' : 'false'; + this.useGoMVS = rhdaData.useGoMVS ? 'true' : 'false'; + this.enablePythonBestEffortsInstallation = rhdaData.enablePythonBestEffortsInstallation ? 'true' : 'false'; + this.usePipDepTree = rhdaData.usePipDepTree ? 'true' : 'false'; this.vulnerabilityAlertSeverity = rhdaData.vulnerabilityAlertSeverity; this.exhortMvnPath = rhdaData.mvn.executable.path || 'mvn'; this.exhortNpmPath = rhdaData.npm.executable.path || 'npm'; diff --git a/test/config.test.ts b/test/config.test.ts index 5c833432..ca6e19ac 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -18,7 +18,10 @@ describe('Config tests', () => { const rhdaData = { exhortSnykToken: 'mockToken', matchManifestVersions: false, - setPythonVirtualEnvironment: true, + usePythonVirtualEnvironment: true, + useGoMVS: true, + enablePythonBestEffortsInstallation: true, + usePipDepTree: true, mvn: { executable: { path: 'mockPath' } }, @@ -45,7 +48,10 @@ describe('Config tests', () => { const partialRhdaData = { exhortSnykToken: 'mockToken', matchManifestVersions: true, - setPythonVirtualEnvironment: false, + usePythonVirtualEnvironment: false, + useGoMVS: false, + enablePythonBestEffortsInstallation: false, + usePipDepTree: false, mvn: { executable: { path: '' } }, @@ -76,7 +82,10 @@ describe('Config tests', () => { expect(mockConfig.utmSource).to.eq(''); expect(mockConfig.exhortSnykToken).to.eq(''); expect(mockConfig.matchManifestVersions).to.eq('true'); - expect(mockConfig.setPythonVirtualEnvironment).to.eq('false'); + expect(mockConfig.usePythonVirtualEnvironment).to.eq('false'); + expect(mockConfig.useGoMVS).to.eq('false'); + expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('false'); + expect(mockConfig.usePipDepTree).to.eq('false'); expect(mockConfig.exhortMvnPath).to.eq('mvn'); expect(mockConfig.exhortNpmPath).to.eq('npm'); expect(mockConfig.exhortGoPath).to.eq('go'); @@ -91,7 +100,10 @@ describe('Config tests', () => { mockConfig.updateConfig(rhdaData); expect(mockConfig.matchManifestVersions).to.eq('false'); - expect(mockConfig.setPythonVirtualEnvironment).to.eq('true'); + expect(mockConfig.usePythonVirtualEnvironment).to.eq('true'); + expect(mockConfig.useGoMVS).to.eq('true'); + expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('true'); + expect(mockConfig.usePipDepTree).to.eq('true'); expect(mockConfig.exhortMvnPath).to.eq('mockPath'); expect(mockConfig.exhortNpmPath).to.eq('mockPath'); expect(mockConfig.exhortGoPath).to.eq('mockPath'); @@ -106,7 +118,10 @@ describe('Config tests', () => { mockConfig.updateConfig(partialRhdaData); expect(mockConfig.matchManifestVersions).to.eq('true'); - expect(mockConfig.setPythonVirtualEnvironment).to.eq('false'); + expect(mockConfig.usePythonVirtualEnvironment).to.eq('false'); + expect(mockConfig.useGoMVS).to.eq('false'); + expect(mockConfig.enablePythonBestEffortsInstallation).to.eq('false'); + expect(mockConfig.usePipDepTree).to.eq('false'); expect(mockConfig.exhortMvnPath).to.eq('mvn'); expect(mockConfig.exhortNpmPath).to.eq('npm'); expect(mockConfig.exhortGoPath).to.eq('go');