本文整理汇总了TypeScript中vsts-task-lib/task.getDelimitedInput函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDelimitedInput函数的具体用法?TypeScript getDelimitedInput怎么用?TypeScript getDelimitedInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDelimitedInput函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
export function run(connection: ContainerConnection): any {
var command = connection.createCommand();
command.arg("build");
var dockerfilepath = tl.getInput("dockerFile", true);
let dockerFile = fileUtils.findDockerFile(dockerfilepath);
if(!tl.exist(dockerFile)) {
throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
}
command.arg(["-f", dockerFile]);
tl.getDelimitedInput("buildArguments", "\n").forEach(buildArgument => {
command.arg(["--build-arg", buildArgument]);
});
var imageName = utils.getImageName();
var qualifyImageName = tl.getBoolInput("qualifyImageName");
if (qualifyImageName) {
imageName = connection.getQualifiedImageNameIfRequired(imageName);
}
command.arg(["-t", tl.getBoolInput("enforceDockerNamingConvention") ? imageUtils.generateValidImageName(imageName) : imageName]);
var baseImageName = imageUtils.imageNameWithoutTag(imageName);
tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
command.arg(["-t", baseImageName + ":" + tag]);
});
var includeSourceTags = tl.getBoolInput("includeSourceTags");
if (includeSourceTags) {
sourceUtils.getSourceTags().forEach(tag => {
command.arg(["-t", baseImageName + ":" + tag]);
});
}
var includeLatestTag = tl.getBoolInput("includeLatestTag");
if (baseImageName !== imageName && includeLatestTag) {
command.arg(["-t", baseImageName]);
}
var memory = tl.getInput("memory");
if (memory) {
command.arg(["-m", memory]);
}
var context: string;
var defaultContext = tl.getBoolInput("defaultContext");
if (defaultContext) {
context = path.dirname(dockerFile);
} else {
context = tl.getPathInput("context");
}
command.arg(context);
return connection.execCommand(command);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:57,代码来源:containerbuild.ts
示例2: addAdditionalTags
function addAdditionalTags() {
var promise: any;
tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
promise = addTag(promise, connection, imageName, baseImageName + ":" + tag);
});
return promise;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:7,代码来源:dockercomposebuild.ts
示例3: run
export function run(connection: ContainerConnection, outputUpdate: (data: string) => any, ignoreArguments?: boolean): any {
let commandArguments = ignoreArguments ? "" : tl.getInput("arguments");
// get tags input
let tags = tl.getDelimitedInput("tags", "\n");
// get qualified image name from the containerRegistry input
let repositoryName = tl.getInput("repository");
let imageNames: string[] = [];
// if container registry is provided, use that
// else, use the currently logged in registries
if (tl.getInput("containerRegistry")) {
let imageName = connection.getQualifiedImageName(repositoryName);
if (imageName) {
imageNames.push(imageName);
}
}
else {
imageNames = connection.getQualifiedImageNamesFromConfig(repositoryName);
}
const dockerfilepath = tl.getInput("dockerFile", true);
const dockerFile = findDockerFile(dockerfilepath);
if (!tl.exist(dockerFile)) {
throw new Error(tl.loc('ContainerDockerFileNotFound', dockerfilepath));
}
// push all tags
let output = "";
let outputImageName = "";
let digest = "";
let imageSize = "";
let promise = pushMultipleImages(connection, imageNames, tags, commandArguments, (image, commandOutput) => {
output += commandOutput;
outputImageName = image;
let extractedResult = extractDigestAndSizeFromOutput(commandOutput, matchPatternForDigestAndSize);
digest = extractedResult[0];
imageSize = extractedResult[1];
tl.debug("outputImageName: " + outputImageName + "\n" + "commandOutput: " + commandOutput + "\n" + "digest:" + digest + "imageSize:" + imageSize);
publishToImageMetadataStore(connection, outputImageName, tags, digest, dockerFile, imageSize).then((result) => {
tl.debug("ImageDetailsApiResponse: " + result);
}, (error) => {
tl.warning("publishToImageMetadataStore failed with error: " + error);
});
});
if (promise) {
promise = promise.then(() => {
let taskOutputPath = utils.writeTaskOutput("push", output);
outputUpdate(taskOutputPath);
});
}
else {
tl.debug(tl.loc('NotPushingAsNoLoginFound'));
promise = Q.resolve(null);
}
return promise;
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:59,代码来源:dockerpush.ts
示例4: initTestConfigurations
function initTestConfigurations(testConfiguration: models.TestConfigurations) {
testConfiguration.pathtoCustomTestAdapters = tl.getInput('pathtoCustomTestAdapters');
testConfiguration.sourceFilter = tl.getDelimitedInput('testAssemblyVer2', '\n', true);
testConfiguration.testDropLocation = tl.getInput('searchFolder');
testConfiguration.testcaseFilter = tl.getInput('testFiltercriteria');
testConfiguration.settingsFile = tl.getPathInput('runSettingsFile');
testConfiguration.overrideTestrunParameters = tl.getInput('overrideTestrunParameters');
testConfiguration.buildConfig = tl.getInput('configuration');
testConfiguration.buildPlatform = tl.getInput('platform');
testConfiguration.testRunTitle = tl.getInput('testRunTitle');
testConfiguration.runInParallel = tl.getBoolInput('runInParallel');
testConfiguration.runTestsInIsolation = tl.getBoolInput('runTestsInIsolation');
testConfiguration.tiaConfig = getTiaConfiguration();
testConfiguration.testSelection = tl.getInput('testSelector');
testConfiguration.otherConsoleOptions = tl.getInput('otherConsoleOptions');
if (testConfiguration.testSelection.toLowerCase() === 'testplan') {
testConfiguration.testplan = parseInt(tl.getInput('testPlan'));
testConfiguration.testPlanConfigId = parseInt(tl.getInput('testConfiguration'));
const testSuiteStrings = tl.getDelimitedInput('testSuite', ',', true);
testConfiguration.testSuites = new Array<number>();
testSuiteStrings.forEach(element => {
testConfiguration.testSuites.push(parseInt(element));
});
}
testConfiguration.vsTestLocationMethod = tl.getInput('vstestLocationMethod');
if (testConfiguration.vsTestLocationMethod === utils.Constants.vsTestVersionString) {
testConfiguration.vsTestVersion = tl.getInput('vsTestVersion');
if (utils.Helper.isNullEmptyOrUndefined(testConfiguration.vsTestVersion)) {
tl._writeLine('vsTestVersion is null or empty');
throw new Error('vsTestVersion is null or empty');
}
} else {
testConfiguration.vsTestLocation = tl.getInput('vsTestLocation');
}
// only to facilitate the writing of unit tests
testConfiguration.vs15HelperPath = tl.getVariable('vs15Helper');
if (!testConfiguration.vs15HelperPath) {
testConfiguration.vs15HelperPath = path.join(__dirname, 'vs15Helper.ps1');
}
testConfiguration.codeCoverageEnabled = tl.getBoolInput('codeCoverageEnabled');
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:46,代码来源:taskinputparser.ts
示例5: getImageMappings
export function getImageMappings(connection: ContainerConnection, imageNames: string[]): ImageMapping[] {
let qualifyImageName = tl.getBoolInput("qualifyImageName");
let imageInfos: ImageInfo[] = imageNames.map(imageName => {
let qualifiedImageName = qualifyImageName ? connection.qualifyImageName(imageName) : imageName;
return {
sourceImageName: imageName,
qualifiedImageName: qualifiedImageName,
baseImageName: imageUtils.imageNameWithoutTag(qualifiedImageName),
taggedImages: []
};
});
let additionalImageTags = tl.getDelimitedInput("additionalImageTags", "\n");
let includeSourceTags = tl.getBoolInput("includeSourceTags");
let includeLatestTag = tl.getBoolInput("includeLatestTag");
let sourceTags: string[] = [];
if (includeSourceTags) {
sourceTags = sourceUtils.getSourceTags();
}
let commonTags: string[] = additionalImageTags.concat(sourceTags);
// For each of the image names, generate a mapping from the source image name to the target image. The same source image name
// may be listed more than once if there are multiple tags. The target image names will be tagged based on the task configuration.
for (let i = 0; i < imageInfos.length; i++) {
let imageInfo = imageInfos[i];
let imageSpecificTags: string[] = [];
if (imageInfo.baseImageName === imageInfo.qualifiedImageName) {
imageSpecificTags.push("latest");
} else {
imageInfo.taggedImages.push(imageInfo.qualifiedImageName);
if (includeLatestTag) {
imageSpecificTags.push("latest");
}
}
commonTags.concat(imageSpecificTags).forEach(tag => {
imageInfo.taggedImages.push(imageInfo.baseImageName + ":" + tag);
});
}
// Flatten the image infos into a mapping between the source images and each of their tagged target images
let sourceToTargetMapping: ImageMapping[] = [];
imageInfos.forEach(imageInfo => {
imageInfo.taggedImages.forEach(taggedImage => {
sourceToTargetMapping.push({
sourceImageName: imageInfo.sourceImageName,
targetImageName: taggedImage
});
});
});
return sourceToTargetMapping;
}
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:55,代码来源:utils.ts
示例6: run
export function run(connection: DockerComposeConnection): any {
var command = connection.createComposeCommand();
command.arg("run");
var detached = tl.getBoolInput("detached");
if (detached) {
command.arg("-d");
}
var entrypoint = tl.getInput("entrypoint");
if (entrypoint) {
command.arg(["--entrypoint", entrypoint]);
}
var containerName = tl.getInput("containerName");
if (containerName) {
command.arg(["--name", containerName]);
}
tl.getDelimitedInput("ports", "\n").forEach(port => {
command.arg(["-p", port]);
});
if (!detached) {
command.arg("--rm");
}
command.arg("-T");
var workDir = tl.getInput("workDir");
if (workDir) {
command.arg(["-w", workDir]);
}
var serviceName = tl.getInput("serviceName", true);
command.arg(serviceName);
var containerCommand = tl.getInput("containerCommand");
if (containerCommand) {
command.line(containerCommand);
}
var promise = connection.execCommand(command);
if (!detached) {
promise = promise.fin(() => {
var downCommand = connection.createComposeCommand();
downCommand.arg("down");
return connection.execCommand(downCommand);
});
}
return promise;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:54,代码来源:dockercomposerun.ts
示例7: getTestSelectorBasedInputs
function getTestSelectorBasedInputs(testConfiguration: models.TestConfigurations) {
const testSelection = testConfiguration.testSelection.toLowerCase();
switch (testSelection) {
case 'testplan':
console.log(tl.loc('testSelectorInput', tl.loc('testPlanSelector')));
testConfiguration.testplan = parseInt(tl.getInput('testPlan'));
console.log(tl.loc('testPlanInput', testConfiguration.testplan));
testConfiguration.testPlanConfigId = parseInt(tl.getInput('testConfiguration'));
console.log(tl.loc('testplanConfigInput', testConfiguration.testPlanConfigId));
const testSuiteStrings = tl.getDelimitedInput('testSuite', ',', true);
testConfiguration.testSuites = new Array<number>();
testSuiteStrings.forEach(element => {
const testSuiteId = parseInt(element);
console.log(tl.loc('testSuiteSelected', testSuiteId));
testConfiguration.testSuites.push(testSuiteId);
});
testConfiguration.sourceFilter = ['**\\*', '!**\\obj\\*'];
tl.debug('Setting the test source filter for the Test plan : ' + testConfiguration.sourceFilter);
break;
case 'testassemblies':
console.log(tl.loc('testSelectorInput', tl.loc('testAssembliesSelector')));
testConfiguration.sourceFilter = tl.getDelimitedInput('testAssemblyVer2', '\n', true);
console.log(tl.loc('testAssemblyFilterInput', testConfiguration.sourceFilter));
testConfiguration.testcaseFilter = tl.getInput('testFiltercriteria');
console.log(tl.loc('testFilterCriteriaInput', testConfiguration.testcaseFilter));
break;
case 'testrun':
console.log(tl.loc('testSelectorInput', tl.loc('testRunSelector')));
testConfiguration.onDemandTestRunId = tl.getInput('tcmTestRun');
if (parseInt(testConfiguration.onDemandTestRunId) <= 0) {
throw new Error(tl.loc('testRunIdInvalid', testConfiguration.onDemandTestRunId));
}
console.log(tl.loc('testRunIdInput', testConfiguration.onDemandTestRunId));
testConfiguration.sourceFilter = ['**\\*', '!**\\obj\\*'];
tl.debug('Setting the test source filter for the TestRun : ' + testConfiguration.sourceFilter);
break;
}
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:41,代码来源:taskinputparser.ts
示例8: constructor
constructor() {
super();
this.dockerComposePath = tl.which("docker-compose", true);
this.dockerComposeFile = DockerComposeUtils.findDockerFile(tl.getInput("dockerComposeFile", true));
if (!this.dockerComposeFile) {
throw new Error("No Docker Compose file matching " + tl.getInput("dockerComposeFile") + " was found.");
}
this.dockerComposeVersion = "2";
this.additionalDockerComposeFiles = tl.getDelimitedInput("additionalDockerComposeFiles", "\n");
this.requireAdditionalDockerComposeFiles = tl.getBoolInput("requireAdditionalDockerComposeFiles");
this.projectName = tl.getInput("projectName");
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:12,代码来源:dockercomposeconnection.ts
示例9: getExternalAuthInfoArray
export async function getExternalAuthInfoArray(inputKey: string): Promise<AuthInfo[]>
{
let externalAuthArray: AuthInfo[] = [];
let endpointNames = tl.getDelimitedInput(inputKey, ",");
if (!endpointNames || endpointNames.length === 0)
{
return externalAuthArray;
}
tl.debug(tl.loc("Info_AddingExternalFeeds", endpointNames.length));
for (let endpointId of endpointNames)
{
let feedUri = tl.getEndpointUrl(endpointId, false);
let endpointName = tl.getEndpointDataParameter(endpointId, "endpointname", false);
let externalAuth = tl.getEndpointAuthorization(endpointId, true);
let scheme = tl.getEndpointAuthorizationScheme(endpointId, true).toLowerCase();
switch(scheme) {
case "token":
const token = externalAuth.parameters["apitoken"];
tl.debug(tl.loc("Info_AddingTokenAuthEntry", feedUri));
externalAuthArray.push(new AuthInfo({
feedName: endpointName,
feedUri,
isInternalSource: false,
} as IPackageSource,
AuthType.Token,
"build", // fake username, could be anything.
token,
));
break;
case "usernamepassword":
let username = externalAuth.parameters["username"];
let password = externalAuth.parameters["password"];
tl.debug(tl.loc("Info_AddingPasswordAuthEntry", feedUri));
externalAuthArray.push(new AuthInfo({
feedName: endpointName,
feedUri,
isInternalSource: false,
} as IPackageSource,
AuthType.UsernamePassword,
username,
password));
break;
case "none":
default:
break;
}
}
return externalAuthArray;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:51,代码来源:authentication.ts
示例10: run
export function run(connection: ContainerConnection): any {
var images = [];
var imageName = tl.getInput("imageName", true);
var qualifyImageName = tl.getBoolInput("qualifyImageName");
if (qualifyImageName) {
imageName = connection.qualifyImageName(imageName);
}
var baseImageName = imageUtils.imageNameWithoutTag(imageName);
if (baseImageName === imageName) {
images.push(imageName + ":latest");
} else {
images.push(imageName);
}
tl.getDelimitedInput("additionalImageTags", "\n").forEach(tag => {
images.push(baseImageName + ":" + tag);
});
var includeSourceTags = tl.getBoolInput("includeSourceTags");
if (includeSourceTags) {
sourceUtils.getSourceTags().forEach(tag => {
images.push(baseImageName + ":" + tag);
});
}
var includeLatestTag = tl.getBoolInput("includeLatestTag");
if (baseImageName !== imageName && includeLatestTag) {
images.push(baseImageName + ":latest");
}
var imageDigestFile: string;
if (tl.filePathSupplied("imageDigestFile")) {
imageDigestFile = tl.getPathInput("imageDigestFile");
}
var promise = dockerPush(connection, images.shift(), imageDigestFile);
images.forEach(imageName => {
promise = promise.then(() => dockerPush(connection, imageName));
});
return promise;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:43,代码来源:containerpush.ts
注:本文中的vsts-task-lib/task.getDelimitedInput函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论