簡體   English   中英

Azure devops:Monorepo 觸發器

[英]Azure devops: Monorepo trigger

我有一個具有以下結構的單回購:

.
├── README.md
├── azure-pipelines.yml
├── common.py
├── sample-job1
|── azure-pipelines-sample-job1.yml
│   └── entry-point1.py
└── sample-job2
    |── azure-pipelines-sample-job2.yml
    └── entry-point2.py

entry-point1.py 和 entry-point2.py 有共同的函數寫在 common.py 中。

  • 如果我對 common.py 進行更改:azure-pipelines 被觸發
  • 如果我對 entry-point1.py 進行更改:azure-pipelines-sample-job1 會被觸發
  • 如果我對 entry-point2.py 進行更改:azure-pipelines-sample-job2 會被觸發

我想補充的是:

  • 如果我對 common.py 進行更改(僅在修改此文件的情況下),除了現有的之外,我還希望觸發其他 2 個管道 azure-pipelines-sample-job1.yml、azure-pipelines-sample-job2.yml觸發 azure-pipelines.yml 的邏輯

這是因為 entry-point1.py 和 entry-point2.py 調用了 common.py,所以每次 common.py 更改時都需要重新構建代碼。

如何添加此觸發器?

以下是我目前擁有的觸發器:

#azure-pipelines.yml

# Build numbering format
name: $(BuildID)

trigger:
  branches:
    include:
      - test
      - feat/*
  paths:
    exclude:
      - 'sample-job1/*'
      - 'sample-job2/*'

pool:
  vmImage: 'ubuntu-latest'

steps:
  - script: |
      echo "Hello from '/' root folder."
  
  

#azure-pipelines-sample-job1.yml

# Build numbering format
name: $(BuildID)

trigger:
  branches:
    include:
      - test
      - feat/*
  paths:
    include:
      - 'sample-job1/*'

pool:
  vmImage: 'ubuntu-latest'

steps:
  - script: |
      echo "Hello from 'sample1'"
  
  

#azure-pipelines-sample-job2.yml

# Build numbering format
name: $(BuildID)

trigger:
  branches:
    include:
      - test
      - feat/*
  paths:
    include:
      - 'sample-job2/*'

pool:
  vmImage: 'ubuntu-latest'

steps:
  - script: |
      echo "Hello from 'sample2'"

如果要在修改文件“ common.py ”時觸發azure-pipelines-sample-job1.ymlazure-pipelines-sample-job2.yml ,只需將其路徑添加到觸發路徑:

天藍色管道樣本-job1.yml

# Build numbering format
name: $(BuildID)
 
trigger:
  branches:
    include:
      - test
      - feat/*
  paths:
    include:
      - 'sample-job1/*'
      - 'common.py'
 
pool:
  vmImage: 'windows-latest'
 
steps:
  - script: |
      echo "Hello from 'sample1'"

天藍色管道樣本-job2.yml

# Build numbering format
name: $(BuildID)
 
trigger:
  branches:
    include:
      - test
      - feat/*
  paths:
    include:
      - 'sample-job2/*'
      - 'common.py'
 
pool:
  vmImage: 'windows-latest'
 
steps:
  - script: |
      echo "Hello from 'sample2'"

有關詳細信息,請參閱: 路徑

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM