Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
utils.executeCliCommand(cliCommand, workDir);
} catch (executionException) {
tl.setResult(tl.TaskResult.Failed, executionException);
} finally {
try {
tl.rmRF(specPath);
} catch (fileException) {
tl.setResult(tl.TaskResult.Failed, "Failed cleaning temporary FileSpec file.");
}
}
// Ignored if previously failed.
tl.setResult(tl.TaskResult.Succeeded, "Download Succeeded.");
}
await common.checkUpdateTasksManifests();
} else {
// Set vsix file argument
let vsixFilePattern = tl.getPathInput("vsixFile", true);
let matchingVsixFile: string[];
if (vsixFilePattern.indexOf("*") >= 0 || vsixFilePattern.indexOf("?") >= 0) {
tl.debug("Pattern found in vsixFile parameter");
matchingVsixFile = tl.findMatch(tl.getInput("cwd", false) || process.cwd(), vsixFilePattern);
}
else {
tl.debug("No pattern found in vsixFile parameter");
matchingVsixFile = [vsixFilePattern];
}
if (!matchingVsixFile || matchingVsixFile.length === 0) {
tl.setResult(tl.TaskResult.Failed, `Found no vsix files matching: ${vsixFilePattern}.`);
return false;
}
if (matchingVsixFile.length !== 1) {
tl.setResult(tl.TaskResult.Failed, `Found multiple vsix files matching: ${vsixFilePattern}.`);
return false;
}
const vsixFile = matchingVsixFile[0];
tl.checkPath(vsixFile, "vsixPath");
vsixOutput = tl.getVariable("System.DefaultWorkingDirectory");
const publisher = tl.getInput("publisherId", false);
const extensionId = tl.getInput("extensionId", false);
const extensionTag = tl.getInput("extensionTag", false);
function cleanup(cliPath, workDir) {
// Delete servers.
try {
utils.deleteCliServers(cliPath, workDir, [serverIdDeployer, serverIdResolver]);
} catch (deleteServersException) {
tl.setResult(tl.TaskResult.Failed, deleteServersException);
}
// Remove extractor variables.
try {
removeExtractorDownloadVariables(cliPath, workDir);
} catch (removeVariablesException) {
tl.setResult(tl.TaskResult.Failed, removeVariablesException);
}
}
case 'customfeed':
tl.debug('Going via custom feed download flow.');
await new NugetFeedInstaller()
.installVsTestPlatformToolFromCustomFeed(packageSource, versionSelectorInput, testPlatformVersion, username, password);
break;
case 'netshare':
tl.debug('Going via net share copy flow.');
await new NetworkShareInstaller().installVsTestPlatformToolFromNetworkShare(networkSharePath);
break;
}
} catch (error) {
ci.publishEvent('Completed', { isSetupSuccessful: 'false' } );
tl.setResult(tl.TaskResult.Failed, error);
return;
}
ci.addToConsolidatedCi('result', constants.installationStatusSucceeded);
}
async function run() {
try {
//get target version
const version = taskLib.getInput('version', false);
console.log('yuniql/input_version: ' + version);
if (version) {
await installer.getYuniql(version, true);
}
}
catch (error) {
console.log('yuniql/error: ' + error.message);
taskLib.setResult(taskLib.TaskResult.Failed, error.message);
}
}
console.log("##vso[task.logissue type=warning]" + tl.loc("DeprecatedTask"));
let connectedServiceName: string = tl.getInput("ConnectedServiceName", true);
let resourceGroupName: string = tl.getInput("ResourceGroupName", true);
let resourceType: string = tl.getInput("ResourceType", true);
let resourceName: string = tl.getInput("ResourceName", true);
let alertRules: IAzureMetricAlertRulesList = JSON.parse(tl.getInput("AlertRules", true));
let notifyServiceOwners: boolean = tl.getInput("NotifyServiceOwners") && tl.getInput("NotifyServiceOwners").toLowerCase() === "true" ? true : false;
let notifyEmails: string = tl.getInput("NotifyEmails");
var azureEndpoint: AzureEndpoint = await new AzureRMEndpoint(connectedServiceName).getEndpoint();
let azureMonitorAlertsUtility :AzureMonitorAlertsUtility = new AzureMonitorAlertsUtility(azureEndpoint, resourceGroupName, resourceType, resourceName);
await azureMonitorAlertsUtility.addOrUpdateAlertRules(alertRules.rules, notifyServiceOwners, notifyEmails);
}
catch (error) {
tl.setResult(tl.TaskResult.Failed, error);
}
}
async function run() {
try {
util.tryRestoreKnownHosts();
let agentPid: string = tl.getTaskVariable(util.postKillAgentSetting);
if (agentPid) {
tl.debug('Killing SSH Agent PID: ' + agentPid);
ps.kill(+agentPid);
} else {
let deleteKey: string = tl.getTaskVariable(util.postDeleteKeySetting);
let sshTool: util.SshToolRunner = new util.SshToolRunner();
sshTool.deleteKey(deleteKey)
}
} catch (err) {
tl.setResult(tl.TaskResult.Failed, err);
}
}
.catch((error) => tl.setResult(tl.TaskResult.Failed, error));
getPathInput: function (inputName: string, required: boolean): string {
if (inputName == "workingDirectory") {
return "";
}
return "";
},
setResult: function (result: tl.TaskResult, message: string): void {
tl.setResult(result, message);
},
setVariable: function (name: string, value: string, secret?: boolean) {
tl.setVariable(name, value, secret ? true : false);
},
TaskResult: {
Failed: tl.TaskResult.Failed,
Succeeded: tl.TaskResult.Succeeded
}
});
mockery.registerMock('./versionfetcher', {
DotNetCoreVersionFetcher: function () {
return {
getVersionInfo: function (versionSpec: string, packageType: string, includePreviewVersions: boolean): Promise {
if (process.env["__case__"] == "matchingversionnotfound") {
return new Promise((resolve, reject) => {
resolve(null);
});
}
return new Promise((resolve, reject) => {
resolve(new VersionInfo(JSON.parse(`{"version":"2.1.0", "runtime-version":"2.1.100", "files":[{"name":"win-x64.zip", "url":"https://pathToWin/zip", "rid":"win-x64"}]}`), "sdk"));
});
.catch(error => tl.setResult(tl.TaskResult.Failed, error));