Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let matchedVersionInfo = utils.getMatchingVersionFromList(versionInfoList, versionSpec, includePreviewVersions);
if (!matchedVersionInfo) {
console.log(tl.loc("MatchingVersionNotFound", packageType, versionSpec));
return null;
}
console.log(tl.loc("MatchingVersionForUserInputVersion", matchedVersionInfo.getVersion(), channelInformation.channelVersion, versionSpec))
return matchedVersionInfo;
})
.catch((ex) => {
tl.error(tl.loc("ErrorWhileGettingVersionFromChannel", versionSpec, channelInformation.channelVersion, JSON.stringify(ex)));
return null;
});
}
else {
tl.error(tl.loc("UrlForReleaseChannelNotFound", channelInformation.channelVersion));
}
}
}
podStatus = getPodStatus(kubectl, podName);
switch (podStatus.phase) {
case 'Succeeded':
case 'Running':
if (isPodReady(podStatus)) {
console.log(`pod/${podName} is successfully rolled out`);
}
break;
case 'Pending':
if (!isPodReady(podStatus)) {
tl.warning(`pod/${podName} rollout status check timedout`);
}
break;
case 'Failed':
tl.error(`pod/${podName} rollout failed`);
break;
default:
tl.warning(`pod/${podName} rollout status: ${podStatus.phase}`);
}
}
error: function (errorMessage) { return tl.error(errorMessage); },
getVariable: function (variableName) { return tl.getVariable(variableName); },
export function assertFileExists(path: string) {
if(!fs.existsSync(path)) {
tl.error(tl.loc('FileNotFoundException', path));
throw new Error(tl.loc('FileNotFoundException', path));
}
}
if (!ftpOptions.serverEndpointUrl.hostname) {
tl.setResult(tl.TaskResult.Failed, tl.loc("FTPNoHostSpecified"));
}
const files: string[] = findFiles(ftpOptions);
const tracker = new ProgressTracker(ftpOptions, files.length);
if (files.length === 0) {
tl.warning(tl.loc("NoFilesFound"));
return;
}
let ftpClient: ftp.Client;
try {
ftpClient = await getFtpClient(ftpOptions);
} catch (err) {
tl.error(err);
tl.setResult(tl.TaskResult.Failed, tl.loc("UploadFailed"));
return;
}
let sleep = (milliseconds: number) => {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
let retryWithNewClient = async (task: () => {}, retry: number) => {
let e = null;
while (retry > 0) {
try {
await task();
return;
} catch (err) {
async function main(): Promise {
try {
tl.setResourcePath(path.join(__dirname, 'task.json'));
let runner: cmakerunner.CMakeRunner = new cmakerunner.CMakeRunner();
await runner.run();
tl.setResult(tl.TaskResult.Succeeded, tl.loc('CMakeSuccess'));
return;
} catch (err) {
tl.debug('Error: ' + err);
tl.error(err);
tl.setResult(tl.TaskResult.Failed, tl.loc('CMakeFailed', err));
return;
}
}
async function main(): Promise {
try {
tl.setResourcePath(path.join(__dirname, 'task.json'));
let runner: vcpkgrunner.VcpkgRunner = new vcpkgrunner.VcpkgRunner();
await runner.run();
tl.setResult(tl.TaskResult.Succeeded, tl.loc('vcpkgSucceeded'));
return 0;
} catch (err) {
tl.debug('Error: ' + err);
tl.error(err);
tl.setResult(tl.TaskResult.Failed, tl.loc('vcpkgFailed', err));
return -1000;
}
}
private writeDockerConfigJson(dockerConfigContent: string, configurationFilePath?: string): void {
if (!configurationFilePath){
this.configurationDirPath = this.getDockerConfigDirPath();
process.env["DOCKER_CONFIG"] = this.configurationDirPath;
configurationFilePath = path.join(this.configurationDirPath, "config.json");
}
tl.debug(tl.loc('WritingDockerConfigToTempFile', configurationFilePath, dockerConfigContent));
if(fileutils.writeFileSync(configurationFilePath, dockerConfigContent) == 0) {
tl.error(tl.loc('NoDataWrittenOnFile', configurationFilePath));
throw new Error(tl.loc('NoDataWrittenOnFile', configurationFilePath));
}
}
public setKubeConfigEnvVariable() {
if (this.kubeconfigFile && fs.existsSync(this.kubeconfigFile)) {
tl.setVariable("KUBECONFIG", this.kubeconfigFile);
}
else {
tl.error(tl.loc('KubernetesServiceConnectionNotFound'));
throw new Error(tl.loc('KubernetesServiceConnectionNotFound'));
}
}