【问题标题】:Visual Studio Build Agent scripted setupVisual Studio Build Agent 脚本设置
【发布时间】:2017-09-11 22:27:37
【问题描述】:

我正在尝试自动化 VSTS 构建代理设置 (https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows)。

但是,此过程中有一个交互式步骤。这是一个需要用户输入的 cmd 脚本文件。我尝试使用设置生成一个 TXT 文件,并运行从该文件读取输入的脚本:

.\config < settings.txt

但它不起作用。我收到了这条消息:

Enter server URL > Enter authentication type (press enter for PAT) > Enter perso
nal access token > Cannot read keys when either application does not have a cons
ole or when console input has been redirected. Try Console.Read.

是否可以通过脚本设置构建代理?有没有办法以这种config.cmd 完美工作的方式“重定向”控制台输入?

【问题讨论】:

  • 您只需配置一次代理以供将来使用。无论是在交互窗口中手动配置还是在配置开始时通过添加选项(如 thom 所说的 url、pat、pool、agent 等)自动配置,它们都可以工作。而自动配置只能节省几秒或几分钟。

标签: powershell azure-pipelines windows-scripting


【解决方案1】:

您是否尝试将 --help 传递给 Config.cmd

下面有一些例子是sn-p的例子:

无人值守的配置和取消配置示例:

使用无人值守配置时记得检查返回码

使用 PAT 身份验证的 VSTS 无人参与配置

Win  : .\config.cmd --unattended --url https://myaccount.visualstudio.com --auth PAT --token <token> --pool default --agent myagent

Unix : ./config.sh --unattended --acceptteeeula --url https://myaccount.visualstudio.com --auth PAT --token <token> --pool default --agent myagent

具有集成 (Windows) 和 (Linux/OSX) 协商身份验证的本地 TFS 的无人值守配置

Win  : .\config.cmd --unattended --url http://mylocaltfsserver:8080/tfs --auth Integrated --pool default --agent myagent

Unix : ./config.sh --unattended --acceptteeeula --url http://mylocaltfsserver:8080/tfs --auth Negotiate --username DOMAIN\USER_NAME --password MyPassword --pool default --agent myagent

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多