首页 > 解决方案 > 如何停止 PublishPipelineArtifact 忽略 .git 目录

问题描述

我一直在为使用 maven 构建的 java 应用程序开发 Azure Devops CICD 管道。几个月前,当我不得不停车时,这是可行的。现在它失败了,因为当我在第一阶段结束时发布工件时不包含 .git 目录。

如果启用系统诊断,我可以在输出中看到这一点

2021-08-24T21:12:12.9417903Z Information, Processing .artifactignore file surfaced 30 files. Total files under source directory: 474
2021-08-24T21:12:12.9418814Z Verbose, Ignoring the following files/folders:
2021-08-24T21:12:12.9419773Z Verbose, /home/vsts/work/1/s/.git/FETCH_HEAD
...

这是任务

# copy downloaded git repository including build in target directory , for use in next stage
      - publish:
        artifact: repository

我没有 .artifactignore 文件。

有没有办法阻止这种情况发生?

标签: azure-devops

解决方案


据此_

steps:
- publish: $(System.DefaultWorkingDirectory)/bin/WebApp
  artifact: WebApp

要发布的文件或文件夹的路径是必需的。它可以是 $(System.DefaultWorkingDirectory) 的绝对路径或相对路径。

请添加发布步骤的路径。


推荐阅读