简体   繁体   English

如何从 Azure DevOps 管道中的 GitHub 存储库运行文件?

[英]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 and System.DefaultWorkingDirectory .Agent.ReleaseDirectorySystem.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.

相关问题 如何从 Azure devops 导出管道列表? - How can I export a list of pipelines from Azure devops? 如何将 Azure DevOps 存储库与 GitHub 存储库同步 - How to synchronize Azure DevOps repo with GitHub repo 如何在 Azure Devops Pipelines 中使用 Github Actions - How to use Github Actions with Azure Devops Pipelines Azure DevOps 流水线能否按特定顺序运行? - Can Azure DevOps pipelines be run in a specific order? 为什么我不能将我的 Azure DevOps 存储库导入到新的 Azure DevOps 存储库? - Why can't I import my Azure DevOps repo to a new Azure DevOps repo? 如何使用 GitHub 分支作为 Azure DevOps 管道的参数? - How to use GitHub Branch as a paramater for Azure DevOps Pipelines? 如何将现有的 github yml 文件用于 Azure devops 管道 - how to use existing github yml files for Azure devops pipelines Azure DevOps Pipelines 从 codeway.yml 文件运行选定的环境 - Azure DevOps Pipelines to run selected envirorment from codeway.yml file 如何将一个参数文件用于使用某些不同参数的模板? (在 DevOps 管道中使用 Powershell 部署 Azure LogicApp) - How can I use one parameter file for templates that use some different parameters? (Azure LogicApp deployment using Powershell in DevOps Pipelines) 在Azure DevOps管道中,我可以同时使用1800分钟的免费时间和付费管道吗 - In Azure DevOps pipelines, can I use both my free 1800 minutes and a paid pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM