我可以在两个不同的名称下引用相同的BitBucket存储库来启用Azure DevOps Services YAML上的



你认为有可能以2个不同的名称和2个不同的路径引用相同的BitBucket存储库,以实现和触发2个不同的阶段?我想在k8上构建和发布7个不同的微服务,但repos只有3个(分在子文件夹中),你这可以实现吗?这个想法是为每个微服务创建不同的模板块。但在模板签出期间,仅使用3 macrorepository(用于开发目的)。让我告诉你我的想法。

resources:
repositories:
############## 3 BITBUCKET BIG REPOS ##############
- repository: omni-omsf-api
type: bitbucket
endpoint: OMNI-OMSF-BitBucket-SC
name: ovsdev/omni-omsf-api
trigger: none
- repository: omni-omsf-extension
type: bitbucket
endpoint: OMNI-OMSF-BitBucket-SC
name: ovsdev/omni-omsf-extension
trigger: none
- repository: omni-omsf-core
type: bitbucket
endpoint: OMNI-OMSF-BitBucket-SC
name: ovsdev/omni-omsf-core
trigger: none
###################################################
############# 7 SUB-REPOS ONLY FOR TRIGGERING #########
- repository: ovs-api-service
type: bitbucket
endpoint: OMNI-OMSF-BitBucket-SC
name: ovsdev/omni-omsf-api
trigger:
branches: 
include: 
- release_qa 
- master
paths: 
include: 
- ovs-api-service/*
###################################################
stages:
- ${{ if or( and( eq( parameters.ovsapiservice, true), eq( variables['Build.Reason'], 'Manual') ), eq( variables['Build.Repository.Name'], 'ovs-api-service') ) }}:
- template: microservice-buildRelease.template.yml
parameters:
dockerFilePath: omni-omsf-api/ovs-api-service/Dockerfile
dockerImageName: ovs-api-service
tag: $(Build.BuildId)
microservicename: ovs-api-service
- ${{ else }}:
- stage:
jobs:
- job:
steps:
- task: Bash@3
displayName: Showing folder hierarchy
inputs:
targetType: 'inline'
script: |
tree $(Pipeline.Workspace)

我可以在两个不同的名称

答案是Yes不同的别名可以引用相同的存储库。

在Azure DevOps Services上启用自定义触发YAML

我阅读了您提供的YAML定义,如果您谈论的是资源部分的触发器,那么答案是NO。

应该指出的是,你所使用的用法是不存在的。

请查看这些官方文章,他们都提到了这一点:

resources.repositories。存储库定义

trigger:触发器# CI触发此存储库,如果没有CI触发跳过(仅适用于Azure Repos)) .

触发资源使用

存储库资源触发器仅适用于Azure Repos Git当前同一组织中的存储库。他们不为GitHub或Bitbucket存储库资源。

所以通过YAML的资源部分触发是无法实现的,你只能在位桶侧设置YAML,条件应该基于位桶侧的公共触发。

最新更新