Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
imranismail committed Dec 7, 2019
1 parent 13e31e4 commit 40f445c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
}
Expand Down Expand Up @@ -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");
}
if (osPlat == "win32") {
toolPath = `${toolPath}.exe`;
toolPath = yield tc.extractTar(toolPath);
toolPath = path.join(toolPath, toolFilename);
}
return yield tc.cacheFile(downloadPath, 'kustomize', 'kustomize', version);
return yield tc.cacheFile(toolPath, toolFilename, toolName, version);
});
}

0 comments on commit 40f445c

Please sign in to comment.