本文整理汇总了TypeScript中azure-pipelines-task-lib/task.assertAgent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript assertAgent函数的具体用法?TypeScript assertAgent怎么用?TypeScript assertAgent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assertAgent函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: acquireTfx
async function acquireTfx(version: string): Promise<string> {
try{
version = toolLib.cleanVersion(version);
let extPath: string;
taskLib.assertAgent('2.115.0');
extPath = taskLib.getVariable('Agent.TempDirectory');
if (!extPath) {
throw new Error('Expected Agent.TempDirectory to be set');
}
extPath = path.join(extPath, 'tfx'); // use as short a path as possible due to nested node_modules folders
taskLib.mkdirP(path.join(extPath));
const npmRunner = new tr.ToolRunner("npm");
npmRunner.arg(["install", "tfx-cli@" + version, "--prefix", extPath]);
const result = npmRunner.execSync({ failOnStdErr: false, silent: true, ignoreReturnCode: false} as tr.IExecOptions);
if (result.code === 0)
{
if (os.platform() === "win32")
{
fs.unlinkSync(path.join(extPath, "/tfx"));
}
return await toolLib.cacheDir(extPath, 'tfx', version);
}
}
catch {
return Promise.reject(new Error("Failed to install tfx"));
}
}
开发者ID:Microsoft,项目名称:vsts-extension-build-release-tasks,代码行数:30,代码来源:TfxInstaller.ts
示例2: _getAgentTemp
export function _getAgentTemp() {
taskLib.assertAgent('2.115.0');
let tempDirectory = taskLib.getVariable('Agent.TempDirectory');
if (!tempDirectory) {
throw new Error(taskLib.loc("AI_AgentTempDirAssert"));
}
return tempDirectory;
}
开发者ID:Caphyon,项目名称:advinst-vsts-task,代码行数:8,代码来源:AdvinstTool.ts
示例3: publishEvent
export function publishEvent(properties: { [key: string]: any }): void {
try {
tl.assertAgent('2.125.0');
publishTelemetry(area, feature, Object.assign(getDefaultProps(), properties));
} catch (err) {
tl.debug('Unable to publish telemetry due to lower agent version.');
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:9,代码来源:cieventlogger.ts
示例4: getTempFolder
export function getTempFolder(): string {
try {
tl.assertAgent('2.115.0');
const tmpDir = tl.getVariable('Agent.TempDirectory');
return tmpDir;
} catch (err) {
tl.warning(tl.loc('UpgradeAgentMessage'));
return os.tmpdir();
}
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:10,代码来源:helpers.ts
示例5: prependPathSafe
export function prependPathSafe(toolPath: string) {
task.assertAgent('2.115.0');
console.log(task.loc('PrependPath', toolPath));
const newPath: string = toolPath + path.delimiter + process.env['PATH'];
task.debug('new Path: ' + newPath);
process.env['PATH'] = newPath;
// instruct the agent to set this path on future tasks
console.log('##vso[task.prependpath]' + toolPath);
}
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:11,代码来源:toolutil.ts
注:本文中的azure-pipelines-task-lib/task.assertAgent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论