當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vsotask.getVariable函數代碼示例

本文整理匯總了TypeScript中vso-task-lib/vsotask.getVariable函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getVariable函數的具體用法?TypeScript getVariable怎麽用?TypeScript getVariable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getVariable函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

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`);
開發者ID:ericmaino,項目名稱:vsts-gitmerge,代碼行數:31,代碼來源:merge.ts

示例2:

// 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}`);

if (replaceRegex === undefined || replaceRegex.length === 0){
	replaceRegex = buildRegex;
}
tl.debug(`Using ${replaceRegex} as the replacement regex`);
開發者ID:dixu99,項目名稱:cols-agent-tasks,代碼行數:30,代碼來源:versionAssemblies.ts

示例3:

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');

tl.debug(`mergeType: ${mergeType}`);
tl.debug(`branchesToMerge: ${branchesToMergeStr}`);
tl.debug(`targetBranch: ${targetBranch}`);
tl.debug(`testMergeAll: ${testMergeAll}`);
tl.debug(`sourceCommitId: ${sourceCommitId}`);
tl.debug(`remoteName: ${remoteName}`);
tl.debug(`sourceBranch: ${sourceBranch}`);
tl.debug(`buildSourceCommitId: ${buildSourceCommitId}`);
tl.debug(`repoUrl: ${repoUrl}`);
if (ut.isEmpty(pat)) {
    tl.debug("No PAT was provided");
} else {
開發者ID:colindembovsky,項目名稱:vsts-gitmerge,代碼行數:31,代碼來源:merge.ts


注:本文中的vso-task-lib/vsotask.getVariable函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。