我读过这个,https ://docs.microsoft.com/en-us/azure/devops/pipelines/repos/pipeline-options-for-git?view = azure-devops 但作为一个 Azure 初学者它不是很有帮助.
我在 GitHub 中有两个存储库,一个通过子模块引用另一个。我已授予 Azure Pipelines 访问 GitHub 中两个存储库的权限。
我已经按照入门指南制作了一个新管道,并将它添加azure-pipelines.yml到我的存储库中。它看起来像这样:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Run Code Online (Sandbox Code Playgroud)
我的.gitmodules确实看起来像这样:
[submodule "src/MySubmodulePath"]
path = src/MySubmodulePath
url = git@github.com:trullock/MySubmoduleProject.git
Run Code Online (Sandbox Code Playgroud)
但我已将其更改为使用 HTTPS,如下所示:
[submodule "src/MySubmodulePath"]
path = src/MySubmodulePath
url = https://github.com/trullock/MySubmoduleProject.git
Run Code Online (Sandbox Code Playgroud)
我仍然可以在管道中的作业的 Checkout 步骤中看到,它没有检查子模块,因为构建失败,因为它们丢失了:
git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules origin
我已经阅读了这个https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema%2Cparameter-schema#checkout并且可以看到它显示了submodules: true|recursive设置,但我把这个放在哪里?
将它放在steps键下会导致构建时出现语法错误。
我遇到了类似的问题,但我需要启用 LFS,但配置应该以相同的方式工作。
在您的情况下,这将是:
steps:
- checkout: self
submodules: true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
756 次 |
| 最近记录: |