本文整理汇总了TypeScript中vsts-task-lib/task.getEndpointAuthorization函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getEndpointAuthorization函数的具体用法?TypeScript getEndpointAuthorization怎么用?TypeScript getEndpointAuthorization使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getEndpointAuthorization函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: execute
async function execute() {
const taskProps: { [key: string]: string; } = { state: 'started'};
ci.publishEvent(taskProps);
const enableApiExecution = await isFeatureFlagEnabled(tl.getVariable('System.TeamFoundationCollectionUri'),
'TestExecution.EnableTranslationApi', tl.getEndpointAuthorization('SystemVssConnection', true).parameters.AccessToken);
try {
utils.Helper.setConsoleCodePage();
const blockRun = isMultiConfigOnDemandRun();
if (blockRun) {
tl.setResult(tl.TaskResult.Failed, tl.loc('MultiConfigNotSupportedWithOnDemand'));
}
const serverBasedRun = isServerBasedRun();
inputParser.setIsServerBasedRun(serverBasedRun);
const enableDiagnostics = await isFeatureFlagEnabled(tl.getVariable('System.TeamFoundationCollectionUri'),
'TestExecution.EnableDiagnostics', tl.getEndpointAuthorization('SystemVssConnection', true).parameters.AccessToken);
inputParser.setEnableDiagnosticsSettings(enableDiagnostics);
if (serverBasedRun) {
ci.publishEvent({
runmode: 'distributedtest', parallelism: tl.getVariable('System.ParallelExecutionType'),
testtype: tl.getInput('testSelector')
});
console.log(tl.loc('distributedTestWorkflow'));
console.log('======================================================');
const inputDataContract = inputParser.parseInputsForDistributedTestRun();
console.log('======================================================');
const test = new distributedTest.DistributedTest(inputDataContract);
test.runDistributedTest();
} else {
ci.publishEvent({ runmode: 'nondistributed' });
console.log(tl.loc('nonDistributedTestWorkflow'));
console.log('======================================================');
const inputDataContract = inputParser.parseInputsForNonDistributedTestRun();
if (enableApiExecution || (inputDataContract.ExecutionSettings
&& inputDataContract.ExecutionSettings.RerunSettings
&& inputDataContract.ExecutionSettings.RerunSettings.RerunFailedTests)) {
if (enableApiExecution) {
console.log('================== API Execution =====================');
inputDataContract.ExecutionSettings.TestPlatformExecutionMode = 'api';
}
const test = new nondistributedtest.NonDistributedTest(inputDataContract);
test.runNonDistributedTest();
} else {
localtest.startTest();
}
console.log('======================================================');
}
} catch (error) {
tl.setResult(tl.TaskResult.Failed, error);
taskProps.result = error.message;
}
finally {
taskProps.state = 'completed';
ci.publishEvent(taskProps);
}
}
示例2: initDtaEnvironment
function initDtaEnvironment(): models.DtaEnvironment {
const dtaEnvironment = {} as models.DtaEnvironment;
dtaEnvironment.tfsCollectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
dtaEnvironment.patToken = tl.getEndpointAuthorization('SystemVssConnection', true).parameters['AccessToken'];
dtaEnvironment.agentName = tl.getVariable('Agent.MachineName') + '-' + tl.getVariable('Agent.Name') + '-' + tl.getVariable('Agent.Id');
//TODO : Consider build scenario
const releaseId = tl.getVariable('Release.ReleaseId');
const phaseId = tl.getVariable('Release.DeployPhaseId');
const projectName = tl.getVariable('System.TeamProject');
const taskInstanceId = getDtaInstanceId();
const parallelExecution = tl.getVariable('System.ParallelExecutionType');
if (releaseId) {
if (parallelExecution && parallelExecution.toLowerCase() === 'multiconfiguration') {
const jobId = tl.getVariable('System.JobId');
dtaEnvironment.environmentUri = 'dta://env/' + projectName + '/_apis/release/' + releaseId + '/' + phaseId + '/' + jobId + '/' + taskInstanceId;
} else {
dtaEnvironment.environmentUri = 'dta://env/' + projectName + '/_apis/release/' + releaseId + '/' + phaseId + '/' + taskInstanceId;
}
} else {
const buildId = tl.getVariable('Build.BuildId');
dtaEnvironment.environmentUri = 'dta://env/' + projectName + '/_apis/build/' + buildId + '/' + taskInstanceId;
}
dtaEnvironment.dtaHostLogFilePath = path.join(tl.getVariable('System.DefaultWorkingDirectory'), 'DTAExecutionHost.exe.log');
return dtaEnvironment;
}
示例3: setConnectionDetails
private static setConnectionDetails(inputs: UserInputs) {
var endpoint: string = tl.getInput("NAC", true);
var credentials = tl.getEndpointAuthorization(endpoint, false)["parameters"];
inputs.url = tl.getEndpointUrl(endpoint, false);
inputs.userName = credentials[RAConstants.USER_NAME];
inputs.password = credentials[RAConstants.PASSWORD];
};
示例4: constructor
constructor(endpointName?: string) {
super();
if(endpointName) {
this.registryAuth = tl.getEndpointAuthorization(endpointName, true).parameters;
}
}
示例5: getOctopusConnectionDetails
export function getOctopusConnectionDetails(name: string): OctoServerConnectionDetails {
const octoEndpointAuthorization = tasks.getEndpointAuthorization(name, false);
const ignoreSSL = tasks.getEndpointDataParameter(name, "ignoreSslErrors", true);
return {
url: tasks.getEndpointUrl(name, false),
apiKey: octoEndpointAuthorization.parameters["apitoken"],
ignoreSslErrors: !!ignoreSSL && ignoreSSL.toLowerCase() === "true"
}
}
示例6: getAuthToken
function getAuthToken() {
var auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
if (auth.scheme.toLowerCase() === 'oauth') {
return auth.parameters['AccessToken'];
}
else {
throw new Error(tl.loc("CredentialsNotFound"))
}
}
示例7: initDtaEnvironment
function initDtaEnvironment(): models.DtaEnvironment {
const dtaEnvironment = {} as models.DtaEnvironment;
dtaEnvironment.tfsCollectionUrl = tl.getVariable('System.TeamFoundationCollectionUri');
dtaEnvironment.patToken = tl.getEndpointAuthorization('SystemVssConnection', true).parameters['AccessToken'];
dtaEnvironment.agentName = tl.getVariable('Agent.MachineName') + '-' + tl.getVariable('Agent.Name') + '-' + tl.getVariable('Agent.Id');
dtaEnvironment.environmentUri = getEnvironmentUri();
dtaEnvironment.dtaHostLogFilePath = path.join(tl.getVariable('System.DefaultWorkingDirectory'), 'DTAExecutionHost.exe.log');
return dtaEnvironment;
}
示例8: getSystemAccessToken
export function getSystemAccessToken(): string {
tl.debug('Getting credentials for local feeds');
const auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
if (auth.scheme === 'OAuth') {
tl.debug('Got auth token');
return auth.parameters['AccessToken'];
} else {
tl.warning('Could not determine credentials to use');
}
}
示例9: getSystemAccessToken
export function getSystemAccessToken(): string {
tl.debug("Getting credentials for local feeds");
let auth = tl.getEndpointAuthorization("SYSTEMVSSCONNECTION", false);
if (auth.scheme === "OAuth") {
tl.debug("Got auth token");
return auth.parameters["AccessToken"];
}
else {
tl.warning("Could not determine credentials to use for NuGet");
}
}
示例10: getSystemAccessToken
export function getSystemAccessToken(): string {
let auth = tl.getEndpointAuthorization('SYSTEMVSSCONNECTION', false);
if (auth.scheme === 'OAuth') {
tl.debug(tl.loc('FoundBuildCredentials'));
return auth.parameters['AccessToken'];
} else {
tl.warning(tl.loc('NoBuildCredentials'));
}
return undefined;
}