简体   繁体   English

将自定义 exe 上传到 Azure Devops 管道

[英]Upload custom exe to Azure Devops pipeline

I'd like to execute a command line app that I created as part of my CI builds.我想执行一个作为 CI 构建的一部分创建的命令行应用程序。

The command line app is not related to the repository on which the build is running.命令行应用程序与运行构建的存储库无关。 (Basically, its a tool that is supposed to send some project related metadata to a company web application to gather some metrics). (基本上,它是一个工具,应该将一些与项目相关的元数据发送到公司 web 应用程序以收集一些指标)。

It seems I can execute it using a Command Line task, as explained here:看来我可以使用命令行任务执行它,如下所述:
How to execute exe in VSTS Release pipeline empty process 如何在VSTS Release管道空进程中执行exe

The question is, however - how do I upload my custom tool into Azure Devops ?然而,问题是 -如何将我的自定义工具上传到 Azure Devops

I know it's possible to create custom tasks ( https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops ), but it seems quite a lot of effort to create, especially given that I have a console tool that is doing what I need.我知道可以创建自定义任务( https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops ),但似乎很多努力创造,特别是考虑到我有一个正在做我需要的控制台工具。

I do this by including a seperate deployment folder in the git repo with my source code.我通过在 git 存储库中包含一个单独的部署文件夹和我的源代码来做到这一点。 This folder contains all the extra stuff (exe's) that I need to call to deploy.此文件夹包含我需要调用以进行部署的所有额外内容(exe)。

You could if you wanted keep these artifacts in a different repo and/or different artifact if you wish as you can get any number of different artifacts如果您愿意,可以将这些工件保存在不同的仓库和/或不同的工件中,因为您可以获得任意数量的不同工件

Then I include the deployment folder when publishing artifacts.然后我在发布工件时包含部署文件夹。 In your build step you pull down the artifacts and it includes your EXE.在您的构建步骤中,您下拉工件,它包括您的 EXE。

You're meant to be able to use things like NPM to install helper libraries on the fly but none of my required libraries were ever supported.您应该能够使用诸如NPM 之类的东西来即时安装帮助程序库,但我所需的库都不支持。

You can also use a self hosted agent which is your own host (Often an Azure VM).您还可以使用作为您自己主机的自托管代理(通常是 Azure VM)。 You install everything you need on there then you install a DevOps self hosted agent which lets build pipelines use it.您在那里安装所需的一切,然后安装 DevOps 自托管代理,让构建管道使用它。

  1. Create a build of your exe创建您的 exe 的构建
  2. Upload your exe to blob storage.将您的 exe 上传到 blob 存储。
  3. Create a SAS token to access your blob.创建一个 SAS 令牌以访问您的 blob。
  4. In your build create a task with a PowerShell script.在您的构建中,使用 PowerShell 脚本创建一个任务。 In the PS script download your exe (unzip), and copy it to Build.StagingDirectory/"yourToolFolder".在 PS 脚本中下载您的 exe(解压缩),并将其复制到 Build.StagingDirectory/"yourToolFolder"。 Then in your PS script run it.然后在你的 PS 脚本中运行它。 You probably want to pass it arguments like the location of the repo on the build agent.您可能想传递它 arguments ,就像构建代理上的存储库位置一样。

A way to achieve this involve create a deployment group and add a server to the group where you have access and privileges to upload your console.实现此目的的一种方法是创建一个部署组并将服务器添加到您有权访问和上传控制台的组中。 it could be onprem or cloud depends in your requirements.它可以是本地或云取决于您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM