@codacy/tools-trivy-0 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -250,7 +250,7 @@ var descriptor = {
250
250
  "Swift"
251
251
  ],
252
252
  filePatterns: ["*"],
253
- supportedOS: ["linux", "darwin"],
253
+ supportedOS: ["linux", "darwin", "win32"],
254
254
  supportedArch: ["x64", "arm64"],
255
255
  supportedRunners: ["local", "container"]
256
256
  };
@@ -329,7 +329,10 @@ var PLATFORM_MAP = {
329
329
  "darwin-arm64": "macOS-ARM64",
330
330
  "darwin-x64": "macOS-64bit",
331
331
  "linux-x64": "Linux-64bit",
332
- "linux-arm64": "Linux-ARM64"
332
+ "linux-arm64": "Linux-ARM64",
333
+ // Windows ships a `.zip` (trivy_{version}_windows-64bit.zip) with `trivy.exe`
334
+ // at the archive root — handled in install (extension + exeName).
335
+ "win32-x64": "windows-64bit"
333
336
  };
334
337
  async function getVersionFromBinary(binaryPath) {
335
338
  try {
@@ -344,7 +347,7 @@ async function getVersionFromBinary(binaryPath) {
344
347
  }
345
348
  }
346
349
  async function resolveBinaryPath(ctx) {
347
- const codacyBin = import_path.default.join(ctx.toolInstallDir, BINARY);
350
+ const codacyBin = import_path.default.join(ctx.toolInstallDir, (0, import_tooling.exeName)(BINARY));
348
351
  const version = await getVersionFromBinary(codacyBin);
349
352
  if (version) return codacyBin;
350
353
  return BINARY;
@@ -598,7 +601,7 @@ var adapter = {
598
601
  */
599
602
  async checkAvailability(ctx) {
600
603
  ctx.logger.debug("Checking availability", { toolId: TOOL_ID });
601
- const codacyBin = import_path.default.join(ctx.toolInstallDir, BINARY);
604
+ const codacyBin = import_path.default.join(ctx.toolInstallDir, (0, import_tooling.exeName)(BINARY));
602
605
  const codacyVersion = await getVersionFromBinary(codacyBin);
603
606
  if (codacyVersion) {
604
607
  ctx.logger.debug("Found trivy in codacy install dir", {
@@ -651,12 +654,13 @@ var adapter = {
651
654
  };
652
655
  }
653
656
  const version = adapter.preferredVersion;
654
- const url = `https://github.com/aquasecurity/trivy/releases/download/v${version}/trivy_${version}_${platformSuffix}.tar.gz`;
655
- const destPath = import_path.default.join(ctx.toolInstallDir, BINARY);
657
+ const archiveExt = import_tooling.IS_WINDOWS ? "zip" : "tar.gz";
658
+ const url = `https://github.com/aquasecurity/trivy/releases/download/v${version}/trivy_${version}_${platformSuffix}.${archiveExt}`;
659
+ const destPath = import_path.default.join(ctx.toolInstallDir, (0, import_tooling.exeName)(BINARY));
656
660
  try {
657
661
  ctx.logger.info(`Downloading trivy v${version} for ${platformKey}...`);
658
662
  await (0, import_tooling.downloadAndExtract)(url, ctx.toolInstallDir, void 0, ctx.logger);
659
- await import_promises.default.chmod(destPath, 493);
663
+ if (!import_tooling.IS_WINDOWS) await import_promises.default.chmod(destPath, 493);
660
664
  ctx.logger.info(`Installed trivy v${version} to ${destPath}`);
661
665
  return { success: true, installedPath: destPath, installedVersion: version };
662
666
  } catch (err) {
package/dist/metadata.js CHANGED
@@ -42,7 +42,7 @@ var descriptor = {
42
42
  "Swift"
43
43
  ],
44
44
  filePatterns: ["*"],
45
- supportedOS: ["linux", "darwin"],
45
+ supportedOS: ["linux", "darwin", "win32"],
46
46
  supportedArch: ["x64", "arm64"],
47
47
  supportedRunners: ["local", "container"]
48
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/tools-trivy-0",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Trivy adapter — CLI-mode security scanner",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "dist"
9
9
  ],
10
10
  "dependencies": {
11
- "@codacy/tooling": "0.14.0"
11
+ "@codacy/tooling": "0.16.0"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Codacy <support@codacy.com> (https://www.codacy.com)",