我有一台笔记本电脑上配置了一个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/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#job进行了检查,并将工作区属性clean设置为clean: outputs
。
在这里https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#checkout进行了检查,并将checkout属性设置为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>
编辑: 要添加更多信息,为运行启用调试变量,我在初始化Job时会在日志中看到它:
##[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'
还有其他人遇到这种情况并且知道如何解决吗?
答案 0 :(得分:0)
子模块初始化是本机支持的,不需要内联脚本。请参阅YAML schema。
steps:
- checkout: self | none | repository name # self represents the repo where the initial Pipelines YAML file was found
clean: boolean # if true, run `execute git clean -ffdx && git reset --hard HEAD` before fetching
fetchDepth: number # the depth of commits to ask Git to fetch; defaults to no limit
lfs: boolean # whether to download Git-LFS files; defaults to false
submodules: true | recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules; defaults to not checking out submodules
path: string # path to check out source code, relative to the agent's build directory (e.g. \_work\1); defaults to a directory called `s`
persistCredentials: boolean # if 'true', leave the OAuth token in the Git config after the initial fetch; defaults to false
您要将submodules
设置为true
或recursive
并删除嵌入式脚本。
答案 1 :(得分:0)
发现这是我没有看过的另一部分,它是通过UI设置的变量build.clean: all
。
具体来说,这是在编辑管道时在“变量”选项卡中。
比我想象的要简单。