Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let downloadAndRunNuget = async(function (cliPath, nugetCommand) {
console.log("NuGet not found in Path. Downloading...");
let downloadPath = await(toolLib.downloadTool("https://dist.nuget.org/win-x86-commandline/v" + NUGET_VERSION + "/nuget.exe"));
toolLib.cacheFile(downloadPath, NUGET_EXE_FILENAME, NUGET_TOOL_NAME, NUGET_VERSION);
addToPathAndExec(cliPath, nugetCommand, NUGET_VERSION);
});
localTools.downloadTool(cliDownloadUrl, null, cliAuthHandlers).then((downloadPath) => {
toolLib.cacheFile(downloadPath, fileName, toolName, jfrogCliVersion).then((cliDir) => {
let cliPath = path.join(cliDir, fileName);
if (!isWindows()) {
fs.chmodSync(cliPath, 0o555);
}
tl.debug("Finished downloading JFrog cli.");
resolve(cliPath);
})
}).catch((err) => {
reject(err);
async function downloadDuffle(version: string): Promise {
let cachedToolPath = toolLib.findLocalTool(DuffleToolName, version);
if (!cachedToolPath) {
let duffleDownloadPath = '';
try {
duffleDownloadPath = getDuffleInstallPath();
const downloadUrl = getDuffleDownloadURL(version);
await download(downloadUrl, duffleDownloadPath, false, true);
} catch (exception) {
throw new Error(tl.loc('DownloadDuffleFailed', getDuffleDownloadURL(version), exception));
}
cachedToolPath = await toolLib.cacheFile(duffleDownloadPath, DuffleToolName + getExecutableExtension(), DuffleToolName, version);
}
const dufflePath = path.join(cachedToolPath, DuffleToolName + getExecutableExtension());
fs.chmod(dufflePath, '777');
return dufflePath;
}
var dockerDownloadPath = await toolLib.downloadTool(getDockerDownloadURL(version, releaseType), dockerToolName + "-" + uuidV4() + getArchiveExtension());
} catch (exception) {
throw new Error(tl.loc("DockerDownloadFailed", getDockerDownloadURL(version, releaseType), exception));
}
var unzipedDockerPath;
if(isWindows) {
unzipedDockerPath = await toolLib.extractZip(dockerDownloadPath);
} else {
//tgz is a tar file packaged using gzip utility
unzipedDockerPath = await toolLib.extractTar(dockerDownloadPath);
}
//contents of the extracted archive are under "docker" directory. caching only "docker(.exe)" CLI
unzipedDockerPath = path.join(unzipedDockerPath, "docker", dockerToolNameWithExtension);
cachedToolpath = await toolLib.cacheFile(unzipedDockerPath, dockerToolNameWithExtension, dockerToolName+ "-" + releaseType, cleanVersion);
}
var Dockerpath = findDocker(cachedToolpath);
if (!Dockerpath) {
throw new Error(tl.loc("DockerNotFoundInFolder", cachedToolpath))
}
fs.chmodSync(Dockerpath, "777");
return Dockerpath;
}