in tasks/Node/src/tasks/AzureDtlCreateCustomImage/task.ts [90:146]
function getInputData(ciName?: string, test?: boolean): CreateCiTaskInputData {
let inputData: CreateCiTaskInputData;
if (test) {
const data: any = testutil.getTestData();
inputData = {
author: data.author ? data.author : 'local',
ciName: ciName ? ciName : data.ciName,
connectedServiceName: 'local',
description: data.description ? data.description : 'Custom image created from local task tests.',
labId: data.labId,
labVmId: data.labVmId,
linuxOsState: data.linuxOsState,
osType: data.osType,
subscriptionId: data.subscriptionId,
windowsOsState: data.windowsOsState
};
} else {
const connectedServiceName: string = String(tl.getInput('ConnectedServiceName', true));
const osType: string = String(tl.getInput('OSType', true));
let author = process.env.RELEASE_RELEASENAME;
let authorType = 'release';
if (!author) {
author = process.env.BUILD_BUILDNUMBER;
authorType = 'build';
}
if (!author) {
author = '';
authorType = 'unknown';
}
let requestedFor = process.env.RELEASE_REQUESTEDFOR;
if (!requestedFor) {
requestedFor = process.env.BUILD_REQUESTEDFOR;
}
let description = tl.getInput('Description', false);
if (!description) {
description = `Custom image created from ${authorType} ${author} requested for ${requestedFor}.`;
}
inputData = {
author: author,
ciName: String(tl.getInput('NewCustomImageName', true)),
connectedServiceName: connectedServiceName,
description: description,
labId: String(tl.getInput('LabId', true)),
labVmId: String(tl.getInput('LabVmId', true)),
linuxOsState: String(tl.getInput('LinuxOsState', equalsIgnoreCase(osType, 'Linux'))),
osType: osType,
subscriptionId: String(tl.getEndpointDataParameter(connectedServiceName, 'SubscriptionId', true)),
windowsOsState: String(tl.getInput('WindowsOsState', equalsIgnoreCase(osType, 'Windows')))
};
}
return inputData;
}