当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript task.getEndpointAuthorization函数代码示例

本文整理汇总了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);
    }
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:59,代码来源:runvstest.ts

示例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;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:28,代码来源:taskinputparser.ts

示例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];
 };
开发者ID:yigaldviri,项目名称:TFS2015-CA-RA-Plugin,代码行数:7,代码来源:userInputsService.ts

示例4: constructor

 constructor(endpointName?: string) {
     super();
     
     if(endpointName) {
         this.registryAuth = tl.getEndpointAuthorization(endpointName, true).parameters;
     }
 }
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:7,代码来源:genericauthenticationtokenprovider.ts

示例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"
    }
}
开发者ID:OctopusDeploy,项目名称:OctoTFS,代码行数:9,代码来源:connection.ts

示例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"))
	}
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:9,代码来源:download.ts

示例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;
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:9,代码来源:taskinputparser.ts

示例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');
    }
}
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:10,代码来源:locationUtilities.ts

示例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");
    }
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:11,代码来源:Authentication.ts

示例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;
}
开发者ID:colindembovsky,项目名称:vsts-tasks,代码行数:11,代码来源:util.ts


注:本文中的vsts-task-lib/task.getEndpointAuthorization函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。