VSTS:存储构建中的 zip 文件以供跨构建使用

VSTS: Store zip files from build for usage across builds

我正在进行一系列构建。有一些构建创建的中间文件,其他构建在其构建过程中使用这些文件。构建过程是在 PowerShell 脚本中编写的。我们正在使用私有代理,因为存在自定义依赖项。

目前,我们在私有代理上使用一个文件夹来存储我们在依赖构建中引用的中间结果。

我们希望将它保存在 VSTS 上(可能是一个 zip 文件),并在我们构建依赖组件时下载并解压缩到一个文件夹。

我们发现 nuget 等不符合要求。

有没有可用的选项?

如果您想将文件存储在 VSTS 而不是本地代理计算机中,您可以将文件存储到 VSTS 中托管的单独存储库中

例如将zip文件($(Build.SourcesDirectory)\my.zip)存储到VSTS git repo (https://account.visualstudio.com/project/_git/filestore)中,您可以在构建过程中执行以下PowerShell脚本:

git clone https://Personal%20Access%20Token:PAT@account.visualstudio.com/project/_git/filestore
Copy-Item $(Build.SourcesDirectory)\my.zip $(Build.SourcesDirectory)\filestore
cd filestore
git add .
git commit -m 'add zip file'
git push oirgin master

执行构建后,zip 文件 my.zip 存储在 VSTS git 存储库中。

我最终将第一个构建的结果作为构建工件的一部分发布,然后用于其他(依赖)构建。做的真好。

此外,发现它等同于在 NuGet 上拥有它。计划稍后迁移到 Nuget。