0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Azure Pipelines にて同時実行数(max concurrency)を1とする方法

Last updated at Posted at 2022-09-13

概要

Azure Pipelines にて同時実行数(concurrency)を1とするには、排他ロック(Exclusive Lock)機能の利用により可能となります

image.png

引用:パイプラインデプロイの承認 - Azure Pipelines | Microsoft Docs

本手順では Enviroment (環境)を用いる手順となっていますが、変数グループ等でも実施できるようです。

環境、サービス接続、リポジトリ、変数グループ、セキュリティで保護されたファイル、エージェント プールに対してチェックを構成できます。

引用:パイプラインデプロイの承認 - Azure Pipelines | Microsoft Docs

検証手順と結果

1. Enviroment を作成後、Exclusive Lock を設定

image.png

image.png

2. 1 で作成したEnviroment(concurrency) を参照したパイプラインを構築

lockBehavior: sequential
jobs:
- job: delay
  pool: Server
  steps:
  - task: Delay@1
    displayName: 'Delay'
    inputs:
      delayForMinutes: 1
- deployment: echo_test
  displayName: 'echo test'
  dependsOn: delay
  pool:
    vmImage: 'ubuntu-20.04'
  environment: concurrency
  strategy:
      runOnce:
        deploy:
          steps:
          - script: echo Hello world

パイプラインの実行を何度か行い、直列で処理さえていることを確認

image.png

参考リンク

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?