diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 79cfad54..a5692bab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,11 +30,6 @@ jobs: os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - - uses: Vampire/setup-wsl@v2 - if: ${{ matrix.os == 'windows-latest' }} - with: - distribution: Alpine - - uses: actions/checkout@v3 with: path: ./ diff --git a/README.md b/README.md index c5d3ce09..86ed1e41 100644 --- a/README.md +++ b/README.md @@ -167,15 +167,9 @@ Output parameters: ## Windows -Windows is currently supported via Windows Subsystem for Linux (WSL). It is -required to set up a WSL distribution prior to invoking the `sbom-action`, for -example, you can add the small Alpine image: - -```yaml -- uses: Vampire/setup-wsl@v2 - with: - distribution: Alpine -``` +This action is tested on Windows, and should work natively on Windows hosts +without WSL. (Note that it previously required WSL, but should now be run +natively on Windows.) ## Diagnostics diff --git a/dist/attachReleaseAssets/index.js b/dist/attachReleaseAssets/index.js index 0653abcd..9d6b6e7d 100644 --- a/dist/attachReleaseAssets/index.js +++ b/dist/attachReleaseAssets/index.js @@ -23438,12 +23438,7 @@ const exec = __importStar(__nccwpck_require__(1514)); */ function execute(cmd, args, options) { return __awaiter(this, void 0, void 0, function* () { - if (process.platform === "win32") { - return yield exec.exec("wsl", [mapToWSLPath(cmd), ...args.map(mapToWSLPath)], options); - } - else { - return exec.exec(cmd, args, options); - } + return exec.exec(cmd, args, options); }); } exports.execute = execute; @@ -23964,6 +23959,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24116,7 +24112,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - return `${syftBinaryPath}/${name}`; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24125,7 +24121,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME; + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/dist/downloadSyft/index.js b/dist/downloadSyft/index.js index 5a2ed7a8..67ece520 100644 --- a/dist/downloadSyft/index.js +++ b/dist/downloadSyft/index.js @@ -23486,12 +23486,7 @@ const exec = __importStar(__nccwpck_require__(1514)); */ function execute(cmd, args, options) { return __awaiter(this, void 0, void 0, function* () { - if (process.platform === "win32") { - return yield exec.exec("wsl", [mapToWSLPath(cmd), ...args.map(mapToWSLPath)], options); - } - else { - return exec.exec(cmd, args, options); - } + return exec.exec(cmd, args, options); }); } exports.execute = execute; @@ -24012,6 +24007,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24164,7 +24160,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - return `${syftBinaryPath}/${name}`; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24173,7 +24169,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME; + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/dist/runSyftAction/index.js b/dist/runSyftAction/index.js index 4cb9c67d..5ec6e85f 100644 --- a/dist/runSyftAction/index.js +++ b/dist/runSyftAction/index.js @@ -23438,12 +23438,7 @@ const exec = __importStar(__nccwpck_require__(1514)); */ function execute(cmd, args, options) { return __awaiter(this, void 0, void 0, function* () { - if (process.platform === "win32") { - return yield exec.exec("wsl", [mapToWSLPath(cmd), ...args.map(mapToWSLPath)], options); - } - else { - return exec.exec(cmd, args, options); - } + return exec.exec(cmd, args, options); }); } exports.execute = execute; @@ -23964,6 +23959,7 @@ exports.SYFT_VERSION = core.getInput("syft-version") || SyftVersion_1.VERSION; const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -24116,7 +24112,7 @@ function downloadSyft() { // Make sure the tool's executable bit is set const syftBinaryPath = `${installPath}_${name}`; yield (0, Executor_1.execute)("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - return `${syftBinaryPath}/${name}`; + return path_1.default.join(syftBinaryPath, name) + exeSuffix; }); } exports.downloadSyft = downloadSyft; @@ -24125,7 +24121,7 @@ exports.downloadSyft = downloadSyft; */ function getSyftCommand() { return __awaiter(this, void 0, void 0, function* () { - const name = exports.SYFT_BINARY_NAME; + const name = exports.SYFT_BINARY_NAME + exeSuffix; const version = exports.SYFT_VERSION; const sourceSyft = yield (0, SyftDownloader_1.downloadSyftFromZip)(version); if (sourceSyft) { diff --git a/src/github/Executor.ts b/src/github/Executor.ts index 67273e5c..9890366a 100644 --- a/src/github/Executor.ts +++ b/src/github/Executor.ts @@ -11,15 +11,7 @@ export async function execute( args: string[], options?: exec.ExecOptions ) { - if (process.platform === "win32") { - return await exec.exec( - "wsl", - [mapToWSLPath(cmd), ...args.map(mapToWSLPath)], - options - ); - } else { - return exec.exec(cmd, args, options); - } + return exec.exec(cmd, args, options); } /** diff --git a/src/github/SyftGithubAction.ts b/src/github/SyftGithubAction.ts index a2f13acc..4cc89cd2 100644 --- a/src/github/SyftGithubAction.ts +++ b/src/github/SyftGithubAction.ts @@ -30,6 +30,8 @@ const PRIOR_ARTIFACT_ENV_VAR = "ANCHORE_SBOM_ACTION_PRIOR_ARTIFACT"; const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "sbom-action-")); const githubDependencySnapshotFile = `${tempDir}/github.sbom.json`; +const exeSuffix = process.platform == "win32" ? ".exe" : ""; + /** * Tries to get a unique artifact name or otherwise as appropriate as possible */ @@ -205,14 +207,14 @@ export async function downloadSyft(): Promise { await execute("sh", [installPath, "-d", "-b", syftBinaryPath, version]); - return `${syftBinaryPath}/${name}`; + return path.join(syftBinaryPath, name) + exeSuffix; } /** * Gets the Syft command to run via exec */ export async function getSyftCommand(): Promise { - const name = SYFT_BINARY_NAME; + const name = SYFT_BINARY_NAME + exeSuffix; const version = SYFT_VERSION; const sourceSyft = await downloadSyftFromZip(version);