Merged PR 270: git tagを検出してビルドを行うPipelineを構築する

## 概要
[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ブランチ上で稼働するかは未動作確認。
This commit is contained in:
湯本 開 2023-07-26 08:14:56 +00:00
parent c3845d7e9c
commit 080e05975e
2 changed files with 115 additions and 0 deletions

View File

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

View File

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