• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

TypeScript task.assertAgent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript task.checkPath函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mock-test.MockTestRunner类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap