diff --git a/lib/installer.js b/lib/installer.js index a85c90f..73b8af0 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -137,7 +137,12 @@ function acquireKustomize(version) { return __awaiter(this, void 0, void 0, function* () { version = semver.clean(version) || ''; let downloadUrl; - let downloadPath; + let toolPath; + let toolFilename = "kustomize"; + let toolName = "kustomize"; + if (osPlat == "win32") { + toolFilename = `${toolFilename}.exe`; + } if (semver.gte(version, "3.3.0")) { downloadUrl = `https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${version}/kustomize_v${version}_%{os}_%{arch}.tar.gz`; } @@ -170,20 +175,16 @@ function acquireKustomize(version) { throw new Error(`Unexpected Arch '${osArch}'`); } try { - downloadPath = yield tc.downloadTool(downloadUrl); + toolPath = yield tc.downloadTool(downloadUrl); } catch (err) { core.debug(err); throw `Failed to download version ${version}: ${err}`; } - let toolPath = downloadPath; if (downloadUrl.endsWith('.tar.gz')) { - let extPath = yield tc.extractTar(downloadPath); - toolPath = path.join(extPath, "kustomize"); + toolPath = yield tc.extractTar(toolPath); + toolPath = path.join(toolPath, toolFilename); } - if (osPlat == "win32") { - toolPath = `${toolPath}.exe`; - } - return yield tc.cacheFile(downloadPath, 'kustomize', 'kustomize', version); + return yield tc.cacheFile(toolPath, toolFilename, toolName, version); }); }