1
1

More than 1 year has passed since last update.

Azure Pipelineでコミットされたブランチごとに実行するpoolを切り替える

Last updated at Posted at 2023-03-15

コミットされたブランチをBuild.SourceBranchNameで取得し、pool名を変数にセットすればOK

trigger:
- main
- staging

variables:
  - name: pool-name
    ${{ if eq(variables['Build.SourceBranchName'], 'main') }}:
      value: 'ubuntu-latest'
    ${{ if eq(variables['Build.SourceBranchName'], 'staging') }}:
      value: 'windows-latest'

pool:
  vmImage: $(pool-name)

steps:
- script: echo Hello, main!
  displayName: 'Run a one-line script'

環境ごとに閉域のパイプラインでそれぞれのセルフホストランナー使わないといけないケースで使えるかもしれません。

疑問

条件分岐しているロジックはpoolではなくどこで動いている?

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1