From 080e05975e0e4031bc2d8415e038b91f91771521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B9=AF=E6=9C=AC=20=E9=96=8B?= Date: Wed, 26 Jul 2023 08:14:56 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20270:=20git=20tag=E3=82=92?= =?UTF-8?q?=E6=A4=9C=E5=87=BA=E3=81=97=E3=81=A6=E3=83=93=E3=83=AB=E3=83=89?= =?UTF-8?q?=E3=82=92=E8=A1=8C=E3=81=86Pipeline=E3=82=92=E6=A7=8B=E7=AF=89?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task2196: git tagを検出してビルドを行うPipelineを構築する](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2196) - 特定のtagをmainブランチに打った時にPipelineが起動するPipeline用の構成YAMLを追加 - タグをトリガーとするPipelineはYAML経由でないと作成できなかったため - Staging/Production用のpipelineを追加 - https://dev.azure.com/ODMSCloud/ODMS%20Cloud/_build?definitionId=11 - https://dev.azure.com/ODMSCloud/ODMS%20Cloud/_build?definitionId=13 - yaml定義によるpipelineはビルド対象のブランチに存在するYAML構成を見てビルドを行う模様 ## レビューポイント - 対処として問題なさそうか - Pipelineの動作(どこのYAMLを見て動くか等)は問題なく理解できる書き方になっているか ## 動作確認状況 - ビルド対象ブランチのazure-pipeline-xxx.yamlを参照してパイプラインが動作するため、実稼働のテストにはマージが前提になる関係上、feature/xxxブランチ上でのみ動作を確認。mainブランチ上で稼働するかは未動作確認。 --- azure-pipelines-production.yml | 56 ++++++++++++++++++++++++++++++++ azure-pipelines-staging.yml | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 azure-pipelines-production.yml create mode 100644 azure-pipelines-staging.yml diff --git a/azure-pipelines-production.yml b/azure-pipelines-production.yml new file mode 100644 index 0000000..5c57493 --- /dev/null +++ b/azure-pipelines-production.yml @@ -0,0 +1,56 @@ +trigger: + tags: + include: + - release-* + +jobs: +- job: initialize + displayName: Initialize + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 + - script: | + git fetch origin main:main + if git merge-base --is-ancestor $(Build.SourceVersion) main; then + echo "This commit is in the main branch." + else + echo "This commit is not in the main branch." + exit 1 + fi + displayName: 'タグが付けられたCommitがmainブランチに存在するか確認' +- job: backend_build + dependsOn: initialize + condition: succeeded('initialize') + displayName: Dictation App Service Deploy + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 +- job: frontend_build + dependsOn: initialize + condition: succeeded('initialize') + displayName: Dictation Static App Service Deploy + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 +- job: migration + condition: succeeded('initialize') + displayName: DB migration + dependsOn: + - initialize + - backend_build + - frontend_build + pool: + name: db-migrate-pipelines + steps: + - checkout: self + clean: true + fetchDepth: 1 diff --git a/azure-pipelines-staging.yml b/azure-pipelines-staging.yml new file mode 100644 index 0000000..4495b2c --- /dev/null +++ b/azure-pipelines-staging.yml @@ -0,0 +1,59 @@ +trigger: + branches: + include: + - main + tags: + include: + - stage-* + +jobs: +- job: initialize + displayName: Initialize + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 + - script: | + git fetch origin main:main + if git merge-base --is-ancestor $(Build.SourceVersion) main; then + echo "This commit is in the main branch." + else + echo "This commit is not in the main branch." + exit 1 + fi + displayName: 'タグが付けられたCommitがmainブランチに存在するか確認' +- job: backend_build + dependsOn: initialize + condition: succeeded('initialize') + displayName: Dictation App Service Deploy + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 +- job: frontend_build + dependsOn: initialize + condition: succeeded('initialize') + displayName: Dictation Static App Service Deploy + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 +- job: migration + condition: succeeded('initialize') + displayName: DB migration + dependsOn: + - initialize + - backend_build + - frontend_build + pool: + name: db-migrate-pipelines + steps: + - checkout: self + clean: true + fetchDepth: 1 \ No newline at end of file