标题所说,我有一个基本存储库,其中包含2-3个助手应用程序,可以加快我的django开发。
Llets说我有这个nimble_auth
git存储库作为subpoule
https://dev.azure.com/nimble/base_repo/_git/nimble_auth/
我的新项目在一个不同的项目上,但在同一组织下。https://dev.azure.com/nimble/new_proj/_git/django_backend/
这是我目前的管道,它与持久凭据无法使用,也无法与手动克隆脚本一起使用。
要清楚,我想要一个工作解决方案,无论是哪个,我都不想修复我的当前解决方案。
django_backend
从该脚本这是当前错误:
trigger:
- develop
resources:
- repo: self
variables:
tag: "$(Build.BuildId)"
stages:
- stage: Build
displayName: Build Docker Images
jobs:
- job: Build
displayName: Build Docker Images
condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
cancelTimeoutInMinutes: 30
pool:
name: Nimble
demands:
- Agent.Name -equals Pipelinus Maximus
steps:
- checkout: self
persistCredentials: true
clean: true
# Clone submodules using HTTPS
- script: |
git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" \
submodule update --init --recursive
displayName: Fetch Submodules
# Build Image from the root directory
- task: Docker@2
displayName: Build Docker Image for Django (api-django)
inputs:
command: build
dockerfile: '$(Build.SourcesDirectory)/Dockerfile'
buildContext: '$(Build.SourcesDirectory)'
tags: |
api-django:$(tag)
希望这是足够的背景,谢谢。
要克隆另一个项目的subsodule,您可以参考下面的步骤。
在您的
NEW_PROJ
在您的管道中,在结帐任务中将Starting: Fetch Submodules
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.250.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /opt/azure/AzureAgent/_work/_temp/2d9074d2-7d50-427d-aaf8-1c74fc1ab69a.sh
Cloning into '/opt/azure/AzureAgent/_work/1/s/nimble_auth'...
remote: TF401019: The Git repository with name or identifier nimble_auth does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://dev.azure.com/nimble/base_repo/_git/nimble_auth/' not found
fatal: clone of 'https://[email protected]/nimble/base_repo/_git/nimble_auth' into submodule path '/opt/azure/AzureAgent/_work/1/s/nimble_auth' failed
Failed to clone 'nimble_auth'. Retry scheduled
Cloning into '/opt/azure/AzureAgent/_work/1/s/nimble_auth'...
remote: TF401019: The Git repository with name or identifier nimble_auth does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://dev.azure.com/nimble/base_repo/_git/nimble_auth/' not found
fatal: clone of 'https://[email protected]/nimble/base_repo/_git/nimble_auth' into submodule path '/opt/azure/AzureAgent/_work/1/s/nimble_auth' failed
Failed to clone 'nimble_auth' a second time, aborting
##[error]Bash exited with code '1'.
Finishing: Fetch Submodules
设置为submodules
ProjectCollection Building Build Service(YourOrgname)
中contributors
组。 (如果您在管道中仍然存在相同的错误,请添加项目级构建服务帐户NEW_PROJ构建服务(yourorgname)
也在贡献者组中。
恢复: