[英]How can I run a file from my GitHub repo in Azure DevOps pipelines?
I have a GitHub repository, in which I have an executable file that I would like to run with a set of parameters.我有一个 GitHub 存储库,其中有一个我想使用一组参数运行的可执行文件。 The file I need to run would follow the below format if run from the command line on a mac.
如果从 Mac 上的命令行运行,我需要运行的文件将遵循以下格式。
./p_executable -v test http://192.168.214.251:8000 username passw0rd
I have successfully been able to create a release pipeline that uses an Agent on my local machine and will run this executable as if I am running it straight from my terminal.我已经成功地创建了一个发布管道,该管道在我的本地计算机上使用代理,并将运行这个可执行文件,就好像我直接从我的终端运行它一样。 For this, I just use a local agent and one stage that contains a single bash task.
为此,我只使用一个本地代理和一个包含单个 bash 任务的阶段。
However, I want to be able to run this file from any machine.但是,我希望能够从任何机器上运行这个文件。 So, I have added my p_executable file to my GitHub repo and linked my repo to my ADO account.
因此,我已将我的 p_executable 文件添加到我的 GitHub 存储库中,并将我的存储库链接到我的 ADO 帐户。
I have added GitHub as an artifact at the start of my release pipeline with the main branch that I would like to use.我在发布管道的开头添加了 GitHub 作为工件,其中包含我想使用的主分支。
However, I cannot work out how to make my bash script find the file.但是,我无法弄清楚如何让我的 bash 脚本找到该文件。
I assume I can add GitHub as an artifact and that will check out my repo and then I can use the files within like I would be able to in Jenkins for example.我假设我可以将 GitHub 添加为工件,这将检查我的存储库,然后我可以像在 Jenkins 中那样使用其中的文件。
Instead, I get a相反,我得到一个
bash exited with code 127
when I try and add a resource and use one of the generic Azure DevOps agents.当我尝试添加资源并使用通用 Azure DevOps 代理之一时。
Any help would be greatly appreciated!任何帮助将不胜感激!
You can specify the path of the executable file through the release predefined variable System.ArtifactsDirectory
.您可以通过发布预定义变量
System.ArtifactsDirectory
指定可执行文件的路径。
The directory to which artifacts are downloaded during deployment of a release.
在发布部署期间将工件下载到的目录。 The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent.
如果需要将工件下载到代理,则在每次部署之前都会清除该目录。 Same as
Agent.ReleaseDirectory
andSystem.DefaultWorkingDirectory
.与
Agent.ReleaseDirectory
和System.DefaultWorkingDirectory
相同。 Example: C:\agent_work\r1\a示例:C:\agent_work\r1\a
Example: $(System.ArtifactsDirectory)\executable file示例:$(System.ArtifactsDirectory)\可执行文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.