Azure Pipeline (マスターブランチ)
masterブランチのプッシュとPRビルドを担当するAzure DevOpsパイプラインです。
ビルド後にSonarQubeによる静的分析を実行し、合格した場合はACRにイメージをプッシュします。
パイプラインのリスト
| パイプライン | YAMLファイル | トリガー |
|---|---|---|
infolineage-api | infra/azure-pipelines/pipelines/api-pipeline.yml | master push / PR |
infolineage-worker | infra/azure-pipelines/pipelines/worker-pipeline.yml | master push / PR |
infolineage-frontend | infra/azure-pipelines/pipelines/frontend-pipeline.yml | master push / PR |
YAML構造
infra/azure-pipelines/
├── pipelines/
│ ├── api-pipeline.yml ← 각 모듈 진입점
│ ├── worker-pipeline.yml
│ └── frontend-pipeline.yml
└── templates/
├── build-java.yml ← Gradle 빌드 템플릿
├── sonar-scan.yml ← SonarQube 분석 템플릿
└── docker-push.yml ← Docker 빌드 & ACR 푸시 템플릿
パイプライン YAML はtemplates/をtemplate参照として再利用します。
# 예시: api-pipeline.yml
stages:
- stage: Build
jobs:
- template: ../templates/build-java.yml
parameters:
module: infolineage-api
- stage: SonarQube
jobs:
- template: ../templates/sonar-scan.yml
parameters:
projectKey: infolineage-api
- stage: Docker
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- template: ../templates/docker-push.yml
parameters:
module: api
トリガー戦略
trigger:
branches:
include:
- master
pr:
branches:
include:
- master
- master push: 3ステップすべて実行 (Build → SonarQube → Docker)
- PRビルド: Build + SonarQubeのみ実行し、Dockerプッシュはスキップします (
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master'))
3段階のフロー
Stage 1: Build
- task: Gradle@3
inputs:
gradleWrapperFile: 'backend/gradlew'
workingDirectory: 'backend'
tasks: ':infolineage-api:bootJar -x test --build-cache'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '25'
options: '-Dorg.gradle.jvmargs="--enable-preview -Xmx2g"'
Stage 2: SonarQube
- task: SonarQubePrepare@5
inputs:
SonarQube: 'SonarQube' # Service Connection 이름
scannerMode: 'Other'
extraProperties: |
sonar.projectKey=infolineage-api
sonar.sources=backend/infolineage-api/src/main
sonar.tests=backend/infolineage-api/src/test
sonar.java.binaries=backend/infolineage-api/build/classes
sonar.java.source=25
- task: SonarQubeAnalyze@5
- task: SonarQubePublish@5
inputs:
pollingTimeoutSec: '300'
Stage 3: Docker → ACR
- task: Docker@2
inputs:
containerRegistry: 'AzureContainerRegistry'
repository: 'infolineage/api'
command: 'buildAndPush'
Dockerfile: 'backend/infolineage-api/Dockerfile'
buildContext: 'backend'
tags: 'latest'
サービス接続のリスト
| 名前 | タイプ | 用途 |
|---|---|---|
SonarQube | SonarQube | SonarQube分析サーバー接続 |
AzureContainerRegistry | Docker Registry | ACR イメージプッシュ |
Azure DevOps → プロジェクト設定 → サービス接続で管理します。
今後の計画
| ステップ | 内容 | 状態 |
|---|---|---|
| ステージング自動デプロイ | Docker Stage 後 K8s ステージング自動ロールアウト | 未実装 |
| Production 手動承認 | Azure DevOps 承認ゲート + 手動デプロイ | 未実装 |
| path trigger | モノレポのパスフィルターで変更されたモジュールのみをビルド | 未実装 |