为什么VSTS构建代理不下载实际的Git LFS文件而只下载元数据?

时间:2017-10-11 15:07:50

标签: git azure-devops git-lfs azure-devops-self-hosted-agent

我试图获取一个新配置的VSTS私有构建代理下载存储在Git LFS中的文件,但它似乎只下载每个文件的元数据,文件内容最终如下:

version https://git-lfs.github.com/spec/v1 
oid sha256:1c4fa4fba8880241858d324b17b6b95512b65f98ea3ea1e959659f0176e45ec2 
size 23552

VSTS构建代理的版本为2.123.0。

为了让Git LFS完全正常工作,请记住这是在内部服务器上运行的私有代理,我必须手动安装它,它的版本为2.3.3。

代理正在运行以下命令;

初​​始化:

2017-10-11T13:19:25.8153872Z ##[command]git version
2017-10-11T13:19:25.9089878Z git version 2.12.2.windows.3
2017-10-11T13:19:25.9245879Z ##[command]git lfs version
2017-10-11T13:19:26.1749886Z git-lfs/2.3.3 (GitHub; windows amd64; go 1.8.3; git c9d3beb0)
2017-10-11T13:19:26.1749886Z ##[command]git config --get remote.origin.url
2017-10-11T13:19:26.2529886Z ##[command]git config gc.auto 0
2017-10-11T13:19:26.2997886Z ##[command]git config --get-all http.https://aaa.visualstudio.com/bbb/_git/ccc.extraheader
2017-10-11T13:19:26.3621886Z ##[command]git config --get-all http.proxy
2017-10-11T13:19:26.4089886Z ##[command]git lfs install --local
2017-10-11T13:19:27.2705886Z Updated git hooks.
2017-10-11T13:19:27.2705886Z Git LFS initialized.

Main Git fetch命令:

2017-10-11T13:19:27.3027886Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" fetch --tags --prune --progress --no-recurse-submodules origin
[...]
2017-10-11T13:19:29.7987886Z Receiving objects:   0% (1/149024)   

Git LFS fetch命令:

2017-10-11T13:21:24.5211886Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" lfs fetch origin 3893c0f7d8847adc21182dfd6d10c5d065bda565
2017-10-11T13:21:24.7745886Z Fetching 3893c0f7d8847adc21182dfd6d10c5d065bda565
2017-10-11T13:21:25.9157886Z ##[command]git checkout --progress --force 3893c0f7d8847adc21182dfd6d10c5d065bda565
2017-10-11T13:21:27.1799886Z Checking out files:   4% (550/11027)   

最终子模块(LFS文件实际驻留的地方)同步:

2017-10-11T13:21:47.8469886Z ##[command]git submodule sync
2017-10-11T13:21:49.2977886Z ##[command]git -c http.https://aaa.visualstudio.com.extraheader="AUTHORIZATION: bearer ********" submodule update --init --force
2017-10-11T13:21:49.9997886Z Submodule 'ExternalSoftware' (https://aaa.visualstudio.com/bbb/_git/ccc.ExternalSoftware) registered for path 'ExternalSoftware'
2017-10-11T13:21:51.5285886Z Cloning into 'E:/agent/_work/1/s/ExternalSoftware'...
2017-10-11T13:21:53.3537886Z Submodule path 'ExternalSoftware': checked out '71ce8e95c4f43447c1d1419be7ffb7829a517c2f'
2017-10-11T13:21:53.3693886Z ##[section]Finishing: Get Sources

那么,我只是为了获取基于LFS的文件的元数据而不是实际的文件内容而做错了什么?

似乎我遇到的问题与Check out git-lfs files on VSTF build略有关系,但问题仍然是由我使用的相同开箱即用的Git LFS支持解决的

更新:
作为测试,我在不同的服务器上尝试了VSTS代理,并且能够下载文件 也就是说,我没有服务器的登录权限,所以我还没有验证文件内容,但记录了以下内容:

2017-10-12T07:44:26.4608720Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" lfs pull
2017-10-12T07:44:29.2051354Z 
2017-10-12T07:44:29.4005140Z Git LFS: (0 of 201 files) 0 B / 36.67 MB                                       
2017-10-12T07:44:29.6005312Z Git LFS: (0 of 201 files) 0 B / 36.67 MB                                       
2017-10-12T07:44:29.8021911Z Git LFS: (0 of 201 files) 0 B / 36.67 MB                                       
2017-10-12T07:44:30.0024064Z Git LFS: (0 of 201 files) 256.00 KB / 36.67 MB                                 
2017-10-12T07:44:30.2025273Z Git LFS: (0 of 201 files) 960.00 KB / 36.67 MB                                 
2017-10-12T07:44:30.4029958Z Git LFS: (0 of 201 files) 1.38 MB / 36.67 MB                                   
2017-10-12T07:44:30.6039364Z Git LFS: (0 of 201 files) 1.62 MB / 36.67 MB                                   
2017-10-12T07:44:30.8049023Z Git LFS: (1 of 201 files) 1.92 MB / 36.67 MB                                   
[...]
2017-10-12T07:45:10.4673396Z Git LFS: (275 of 275 files) 103.98 MB / 103.98 MB                              
2017-10-12T07:45:10.4943356Z ##[section]Finishing: Pull external software LFS files

对于其他第三方"能力"原因是,我还不能使用该代理,但它证明该机制应该能够适用于我的存储库。

更新:
完整的日志是由@ Marina-MSFT请求的,所以这里(从最近的运行开始,所以时间戳与上面的有点不同):

2017-10-13T10:26:07.0921581Z ##[section]Starting: Get Sources
2017-10-13T10:26:07.1389599Z Syncing repository: ccc (TfsGit)
2017-10-13T10:26:07.1545605Z Prepending Path environment variable with directory containing 'git.exe'.
2017-10-13T10:26:07.1545605Z ##[command]git version
2017-10-13T10:26:07.2481641Z git version 2.12.2.windows.3
2017-10-13T10:26:07.2637647Z ##[command]git lfs version
2017-10-13T10:26:07.3271672Z git-lfs/2.3.3 (GitHub; windows amd64; go 1.8.3; git c9d3beb0)
2017-10-13T10:26:07.3583684Z ##[command]git config --get remote.origin.url
2017-10-13T10:26:07.4363714Z ##[command]git config gc.auto 0
2017-10-13T10:26:07.4987738Z ##[command]git config --get-all http.https://aaa.visualstudio.com/bbb/_git/ccc.extraheader
2017-10-13T10:26:07.5923774Z ##[command]git config --get-all http.proxy
2017-10-13T10:26:07.6859810Z ##[command]git lfs install --local
2017-10-13T10:26:08.2328280Z Updated git hooks.
2017-10-13T10:26:08.2338281Z Git LFS initialized.
2017-10-13T10:26:08.2650293Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" fetch --tags --prune --progress --no-recurse-submodules origin
2017-10-13T10:26:08.9358551Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" lfs fetch origin 440cb61e73a938c4c83da56823b53d13198ca9b9
2017-10-13T10:26:09.2744832Z Fetching 440cb61e73a938c4c83da56823b53d13198ca9b9
2017-10-13T10:26:11.4949033Z ##[command]git checkout --progress --force 440cb61e73a938c4c83da56823b53d13198ca9b9
2017-10-13T10:26:11.8381165Z HEAD is now at 440cb61e7... [some commit]
2017-10-13T10:26:12.8444104Z ##[command]git submodule sync --recursive
2017-10-13T10:26:14.2328638Z Synchronizing submodule url for 'ExternalSoftware'
2017-10-13T10:26:14.8100860Z ##[command]git -c http.https://aaa.visualstudio.com.extraheader="AUTHORIZATION: bearer ********" submodule update --init --force --recursive
2017-10-13T10:26:17.0409718Z Submodule path 'ExternalSoftware': checked out '71ce8e95c4f43447c1d1419be7ffb7829a517c2f'
2017-10-13T10:26:17.3529838Z ##[command]git config http.https://aaa.visualstudio.com/bbb/_git/ccc.extraheader "AUTHORIZATION: bearer ********"
2017-10-13T10:26:17.3997856Z ##[command]git config http.https://aaa.visualstudio.com/bbb/_git/ccc.extraheader "AUTHORIZATION: bearer ********"
2017-10-13T10:26:17.4621880Z ##[section]Finishing: Get Sources

2017-10-13T10:26:17.4621880Z ##[section]Starting: Pull external software LFS files
2017-10-13T10:26:17.4933892Z ==============================================================================
2017-10-13T10:26:17.4933892Z Task         : Command Line
2017-10-13T10:26:17.4933892Z Description  : Run a command line with arguments
2017-10-13T10:26:17.4933892Z Version      : 1.1.3
2017-10-13T10:26:17.4933892Z Author       : Microsoft Corporation
2017-10-13T10:26:17.4933892Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2017-10-13T10:26:17.4933892Z ==============================================================================
2017-10-13T10:26:17.5713922Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" lfs pull
2017-10-13T10:26:18.3030596Z 
2017-10-13T10:26:18.4840777Z Git LFS: (0 of 275 files) 0 B / 103.98 MB                                      
2017-10-13T10:26:18.6790972Z Git LFS: (0 of 275 files) 0 B / 103.98 MB                                      
[...]
2017-10-13T10:26:33.2805572Z Git LFS: (0 of 275 files) 0 B / 103.98 MB                                      
2017-10-13T10:26:33.3877660Z ##[error]^C

2017-10-13T10:26:33.3877660Z Git LFS: (0 of 275 files) 0 B / 103.98 MB                                      
2017-10-13T10:26:33.3877660Z ##[error]The operation was canceled.
2017-10-13T10:26:33.4033666Z ##[section]Finishing: Pull external software LFS files

1 个答案:

答案 0 :(得分:0)

基本上,它正在克隆子模块但绕过子模块的LFS。 GitHub上讨论了多年来 的工作方式。

尝试添加delayedSubmit任务并运行Command Line作为构建的第一步。