在Azure DevOps CI管道中,没有下载几个Azure DevOps Repo的文件夹

发布于 2025-01-27 08:59:03 字数 332 浏览 5 评论 0原文

我在Azure DevOps中创建了CI管道。我的存储库是Azure DevOps Repo。

我的回购尺寸很大,因此我不希望在Agent Machine上下载一些文件夹,因为这些文件夹是多余的,用于构建代码。

我需要在管道yaml文件中进行哪些更改?

例如,不应下载folderx

I have Created a CI Pipeline in Azure Devops. My Repo is Azure DevOps Repo.

My Repo size is big so i do NOT want some of Folders to be downloaded on agent machine as Those folders are redundant for code build.

What changes i need to do in my pipeline yaml file?

enter image description here

for example FolderX should not be downloaded

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故人爱我别走 2025-02-03 08:59:03

在克隆过程中,您不能具体地排除文件夹。目前,Azure DevOps不支持Git Blob过滤器。

You cannot specific exclude folders during cloning. At present time, Azure DevOps does not support Git blob filters.

魔法唧唧 2025-02-03 08:59:03

即使您添加.gitignore,它也会克隆整个存储库内容。

您可以通过命令行任务自定义结帐步骤,其中“ git sparse-checkout ”。

如下:

trigger: none

pool:
  vmImage: ubuntu-latest

steps:
- checkout: none
- script: |
    git init $(System.TeamProject) && cd $(System.TeamProject)    
    git config core.sparsecheckout true
    echo '/*' >> .git/info/sparse-checkout
    echo '!testfolder2/*' >> .git/info/sparse-checkout
    git remote add origin https://anything:$(PAT)@dev.azure.com/{yourorg}/{yourproject}/_git/{yourrepo}
    git pull origin main
    git checkout main && ls

“在此处输入图像描述”

您可以找到类似的链接在这里在这里

It will clone the whole repository content even you add .gitignore.

You could customize the checkout step via Command line task with "git sparse-checkout".

Sample as below:

trigger: none

pool:
  vmImage: ubuntu-latest

steps:
- checkout: none
- script: |
    git init $(System.TeamProject) && cd $(System.TeamProject)    
    git config core.sparsecheckout true
    echo '/*' >> .git/info/sparse-checkout
    echo '!testfolder2/*' >> .git/info/sparse-checkout
    git remote add origin https://anything:$(PAT)@dev.azure.com/{yourorg}/{yourproject}/_git/{yourrepo}
    git pull origin main
    git checkout main && ls

enter image description here

You can find similar link here and here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文