温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - How stop Azure Pipeline Self-Hosted agent to delete sources
azure-devops azure-pipelines

其他 - 如何停止Azure Pipeline自托管代理删除源

发布于 2020-04-12 10:21:24

我有一台笔记本电脑上配置了一个Azure Pipeline自托管代理(Windows),因此所有内容都是持久的。使用该管道的管道,克隆存储库,然后运行CMake配置,该配置进一步通过来下载几个子模块git submodule update --init

尽管我认为我可以以任何方式配置管道,但只能清理输出,所以在每次新运行时,二进制文件(而不是源代码)都会再次下载子模块。
我知道它以一个空的仓库开始,因为在结帐步骤日志中我看到:

git init "C:\agent\_work\3\s"
Initialized empty Git repository in C:/agent/_work/3/s/.git/

我已经在此处https://docs.microsoft.com/zh-cn/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job进行了检查,并将工作区属性设置为clean: outputs
在此处检查https://docs.microsoft.com/zh-cn/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout并将checkout属性设置为clean clean: false
我还控制了网站上管道的配置没有激活clean属性。

我似乎记得大约6个月前或更长时间(当您使用时clean: binaries),它工作正常。

这是管道外观的非常简化的版本:

jobs:
  - job: AJob
    displayName: "A job"

    pool: "Self Hosted"

    workspace:
      clean: outputs

    steps:
    - powershell: |
        git config --global core.autocrlf false
        git config --global core.symlinks true

    - checkout: self
      clean: false

    - powershell: |
        git submodule update --init <path to submodule>

编辑:要添加更多信息,为运行启用调试变量,我在初始化作业时会在日志中看到此信息:

##[debug]Delete existing build directory: 'C:\agent\_work\3' <---- why :\
##[debug]Deleting build directory: 'C:\agent\_work\3'
##[debug]Creating build directory: 'C:\agent\_work\3'
##[debug]Delete existing artifacts directory: 'C:\agent\_work\3\a'
##[debug]Creating artifacts directory: 'C:\agent\_work\3\a'
##[debug]Delete existing test results directory: 'C:\agent\_work\3\TestResults'
##[debug]Creating test results directory: 'C:\agent\_work\3\TestResults'
##[debug]Creating binaries directory: 'C:\agent\_work\3\b'
##[debug]Creating source directory: 'C:\agent\_work\3\s'

还有其他人遇到这种情况并且知道如何解决吗?

查看更多

提问者
Smjert
被浏览
107
Smjert 2020-02-03 18:27

发现这是build.clean: all通过UI设置的变量,是我没有看过的另一部分。
具体来说,这是在编辑管道时在“变量”选项卡中。
比我想象的简单。