本文整理汇总了TypeScript中vso-task-lib/vsotask.getInput函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getInput函数的具体用法?TypeScript getInput怎么用?TypeScript getInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getInput函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import * as tl from 'vso-task-lib/vsotask';
import * as sh from 'shelljs';
import * as fs from 'fs';
tl.debug("Starting Version Assemblies step");
// get the task vars
var sourcePath = tl.getPathInput("sourcePath", true, true);
var filePattern = tl.getInput("filePattern", true);
var buildRegex = tl.getInput("buildRegex", true);
var buildRegexIndex = tl.getInput("buildRegexIndex", false);
var replaceRegex = tl.getInput("replaceRegex", false);
var replacePrefix = tl.getInput("replacePrefix", false);
var failIfNoMatchFoundStr = tl.getInput("failIfNoMatchFound", false);
var failIfNoMatchFound = false;
if (failIfNoMatchFoundStr === 'true') {
failIfNoMatchFound = true;
}
// get the build number from the env vars
var buildNumber = tl.getVariable("Build.BuildNumber");
tl.debug(`sourcePath :${sourcePath}`);
tl.debug(`filePattern : ${filePattern}`);
tl.debug(`buildRegex : ${buildRegex}`);
tl.debug(`buildRegexIndex : ${buildRegexIndex}`);
tl.debug(`replaceRegex : ${replaceRegex}`);
tl.debug(`replacePrefix : ${replacePrefix}`);
tl.debug(`failIfNoMatchFound : ${failIfNoMatchFound}`);
tl.debug(`buildNumber : ${buildNumber}`);
示例2:
import * as tl from 'vso-task-lib/vsotask';
import * as tr from 'vso-task-lib/toolrunner';
import * as ut from './functions';
tl.debug("Starting 'Git Merge' task");
// get the task vars
var mergeType = tl.getInput("mergeType", true);
var branchesToMergeStr = tl.getInput("branchesToTest", false);
var branchToMergeInto = tl.getInput("branchToMergeInto", false);
var testMergeAll = tl.getBoolInput("testMergeAll", true);
var remoteName = tl.getInput("remoteName", true);
var buildSourceBranch = tl.getVariable("Build.SourceBranch");
var commitId = tl.getVariable("Build.SourceVersion");
tl.debug(`mergeType: ${mergeType}`);
tl.debug(`branchesToMerge: ${branchesToMergeStr}`);
tl.debug(`branchToMergeInto: ${branchToMergeInto}`);
tl.debug(`testMergeAll: ${testMergeAll}`);
tl.debug(`remoteName: ${remoteName}`);
tl.debug(`buildSourceBranch: ${buildSourceBranch}`);
tl.debug(`commitId: ${commitId}`);
tl.cd(tl.getVariable("Build.SourcesDirectory"));
// fetch the remote branches
var res = ut.execGit(["fetch", remoteName]);
if (mergeType === "test") {
var branchesToMerge = branchesToMergeStr.split(',');
console.info(`Found ${branchesToMerge.length} branches to test`);
示例3: RegExp
import * as tl from 'vso-task-lib/vsotask';
import * as sh from 'shelljs';
tl.debug("Starting Version Assemblies step");
// get the task vars
var sourcePath = tl.getPathInput("sourcePath", true, true);
var filePattern = tl.getInput("filePattern", true);
var buildRegex = tl.getInput("buildRegex", true);
var replaceRegex = tl.getInput("replaceRegex", false);
// get the build number from the env vars
var buildNumber = tl.getVariable("Build.BuildNumber");
tl.debug(`sourcePath :${sourcePath}`);
tl.debug(`filePattern : ${filePattern}`);
tl.debug(`buildRegex : ${buildRegex}`);
tl.debug(`replaceRegex : ${replaceRegex}`);
tl.debug(`buildNumber : ${buildNumber}`);
if (replaceRegex === undefined || replaceRegex.length === 0){
replaceRegex = buildRegex;
}
tl.debug(`Using ${replaceRegex} as the replacement regex`);
var buildRegexObj = new RegExp(buildRegex);
if (buildRegexObj.test(buildNumber)) {
var versionNum = buildRegexObj.exec(buildNumber)[0];
console.info(`Using version ${versionNum} in folder ${sourcePath}`);
// get a list of all files under this root
示例4:
import * as tl from 'vso-task-lib/vsotask';
import * as tr from 'vso-task-lib/toolrunner';
import * as ut from './functions';
tl.debug("Starting 'Git Merge' task");
// get the task vars
var mergeType = tl.getInput("mergeType", true);
var branchesToMergeStr = tl.getInput("branchesToTest", false);
var testMergeAll = tl.getBoolInput("testMergeAll", true);
var targetBranch = tl.getInput("targetBranch", true);
var sourceCommitId = tl.getInput("sourceCommitId", false);
var remoteName = tl.getInput("remoteName", true);
// ===================================================================================================
// TODO: repoUrl could actually be determined as follows:
// var tfsUri = tl.getVariable("System.TeamFoundationServerURI");
// var tfsProject = tl.getVariable("System.TeamProject");
// var repoName = tl.getVariable("Build.RepositoryName");
// var repoUrl = `${tfsUri}/${tfsProject}/${repoName}`;
// unfortunately, the repo name isn't correct in the release vars, so the user must pass it in for now
// also, if the user uses a Github repo, we may want to leave the option to specify the url and PAT?
// ===================================================================================================
var repoUrl = tl.getInput("repoUrl", true);
var pat = tl.getInput("pat", false);
// get build vars
var sourceBranch = tl.getVariable("Build.SourceBranchName");
var buildSourceCommitId = tl.getVariable("Build.SourceVersion");
var token = tl.getVariable('System.AccessToken');