Visual Studio Build Agent脚本安装

Adi*_* Jr 3 powershell windows-scripting azure-pipelines

我正在尝试自动化VSTS Build Agent安装程序(https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows)。

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

.\config < settings.txt
Run Code Online (Sandbox Code Playgroud)

但这没有用。我收到该消息:

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.
Run Code Online (Sandbox Code Playgroud)

是否可以通过脚本设置构建代理?有什么方法config.cmd可以完美地“重定向”控制台输入吗?

tho*_*her 5

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

以下是一些示例,其中是一些示例片段:

无人参与的配置和取消配置示例:

使用无人参与配置时,请记住检查返回代码具有PAT身份验证的VSTS的无人参与配置Win:。\ config.cmd-无人参与--url https://myaccount.visualstudio.com --auth PAT-令牌--pool默认- -ag ent myagent Unix:./config.sh-无人参与--acceptteeeula --url https://myaccount.visualstudio.com --auth PAT --token --po ol默认--agent myagent

带有集成(Windows)和(Linux / OSX)的本地TFS的无人参与配置协商身份验证Win:。\ config.cmd-无人参与--url http:// mylocaltfsserver:8080 / tfs --auth集成--pool默认值--agent myagent Unix:./config.sh-无人参与--acceptteeeula --url http:// mylocaltfsserver:8080 / tfs --auth协商-用户名DOMAI N \ USER_NAME --password MyPassword --pool default-代理myagent