我正在尝试在 Teamcity
中创建构建步骤有一个 Artifact Dependency
在另一个构建步骤上。
上一个构建步骤的工件可作为 .zip
获得。文件。
构建步骤能够检索工件并将它们下载到:
C:\BuildAgent\work\27f84e3eca3a33d5\artifactdir\artifacts.zip
显然是
.zip
文件对我没有多大用处,我需要解压缩这些文件,以便构建步骤可以访问构建文件。如何让 TeamCity 解压缩工件?
最佳答案
您可以使用 神器规则 工件依赖项指定要用作依赖项的一部分的工件的元素,包括从文件中提取 .工件规则语法是:
[+:|-:]SourcePath[!ArchivePath][=>DestinationPath]
存档路径 是您在这里特别感兴趣的元素。
使用您的示例,您的工件规则如下所示:
artifacts.zip!** => artifactdir
这将提取 artifacts.zip 工件的所有内容,并将它们放在结帐目录根目录下的 artifactdir 目录中
ArchivePath is used to extract downloaded compressed artifacts. Zip, 7-zip, jar, tar and tar.gz are supported. ArchivePath follows general rules for SourcePath: ant-like wildcards are allowed, the files matched inside the archive will be placed in the directory corresponding to the first wildcard match (relative to destination path) For example: release.zip!*.dll command will extract all .dll files residing in the root of the release.zip artifact.
您可以找到完整的 TeamCity Artifact 依赖文档 here
关于TeamCity 提取工件依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5369629/