Merged PR 240: pipelineの構造をexportしてgit管理する
## 概要 [Task2205: pipelineの構造をexportしてgit管理する](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/2205) - PipelineをYAML形式でExportし、git管理に追加 ## レビューポイント - 配置するディレクトリ名などは適切であるか - JSON形式だと未設定の項目の情報なども出て10倍弱のサイズになってしまうため、可読性の観点でJSONでなくYAMLを選択したが問題ないか
This commit is contained in:
parent
3df4dc557b
commit
f658201d5a
116
configurations/pipeline/ODMS Deploy.yml
Normal file
116
configurations/pipeline/ODMS Deploy.yml
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
# Variable 'static_dictation_deployment_token' was defined in the Variables tab
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- refs/heads/develop
|
||||||
|
jobs:
|
||||||
|
- job: Job_1
|
||||||
|
displayName: Dictation App Service Deploy
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
clean: true
|
||||||
|
fetchDepth: 1
|
||||||
|
- task: Npm@1
|
||||||
|
displayName: npm ci
|
||||||
|
inputs:
|
||||||
|
command: ci
|
||||||
|
workingDir: dictation_server
|
||||||
|
verbose: false
|
||||||
|
- task: AzureKeyVault@2
|
||||||
|
displayName: 'Azure Key Vault: kv-odms-secret-dev'
|
||||||
|
enabled: False
|
||||||
|
inputs:
|
||||||
|
ConnectedServiceName: 82047c72-0cfe-43b0-bb2f-cdfd8b165e68
|
||||||
|
KeyVaultName: kv-odms-secret-dev
|
||||||
|
- task: Bash@3
|
||||||
|
displayName: Bash Script (Test)
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
filePath: cd dictation_server && JWT_PUBLIC_KEY="$JWT_PUBLIC_KEY" && npm run test
|
||||||
|
script: cd dictation_server && npm run test
|
||||||
|
- task: Docker@0
|
||||||
|
displayName: build
|
||||||
|
inputs:
|
||||||
|
azureSubscriptionEndpoint: 827be338-1846-4102-b006-f457c92883d3
|
||||||
|
azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}'
|
||||||
|
dockerFile: DockerfileServerDictation.dockerfile
|
||||||
|
imageName: $(Build.Repository.Name)/dictation:latest
|
||||||
|
- task: Docker@0
|
||||||
|
displayName: Push
|
||||||
|
inputs:
|
||||||
|
azureSubscriptionEndpoint: 827be338-1846-4102-b006-f457c92883d3
|
||||||
|
azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}'
|
||||||
|
action: Push an image
|
||||||
|
imageName: $(Build.Repository.Name)/dictation:latest
|
||||||
|
- job: Job_2
|
||||||
|
displayName: Dictation Static App Service Deploy
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
clean: true
|
||||||
|
fetchDepth: 1
|
||||||
|
- task: Npm@1
|
||||||
|
displayName: npm ci
|
||||||
|
inputs:
|
||||||
|
command: ci
|
||||||
|
workingDir: dictation_client
|
||||||
|
verbose: false
|
||||||
|
- task: Bash@3
|
||||||
|
displayName: Bash Script
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
script: cd dictation_client && npm run build
|
||||||
|
- task: AzureStaticWebApp@0
|
||||||
|
displayName: 'Static Web App: '
|
||||||
|
inputs:
|
||||||
|
app_location: /dictation_client/build
|
||||||
|
config_file_location: /dictation_client
|
||||||
|
skip_app_build: true
|
||||||
|
skip_api_build: true
|
||||||
|
is_static_export: false
|
||||||
|
verbose: false
|
||||||
|
azure_static_web_apps_api_token: $(static_dictation_deployment_token)
|
||||||
|
- job: Job_3
|
||||||
|
displayName: DB migration
|
||||||
|
dependsOn:
|
||||||
|
- Job_1
|
||||||
|
- Job_2
|
||||||
|
pool:
|
||||||
|
name: db-migrate-pipelines
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
clean: true
|
||||||
|
fetchDepth: 1
|
||||||
|
- task: GoTool@0
|
||||||
|
displayName: Use Go 1.18
|
||||||
|
inputs:
|
||||||
|
version: 1.18
|
||||||
|
- task: Go@0
|
||||||
|
displayName: go install
|
||||||
|
inputs:
|
||||||
|
command: custom
|
||||||
|
customCommand: install
|
||||||
|
arguments: github.com/rubenv/sql-migrate/sql-migrate@latest
|
||||||
|
- task: AzureKeyVault@2
|
||||||
|
displayName: 'Azure Key Vault: kv-odms-secret-dev'
|
||||||
|
inputs:
|
||||||
|
ConnectedServiceName: 82047c72-0cfe-43b0-bb2f-cdfd8b165e68
|
||||||
|
KeyVaultName: kv-odms-secret-dev
|
||||||
|
- task: CmdLine@2
|
||||||
|
displayName: migration
|
||||||
|
inputs:
|
||||||
|
script: >2
|
||||||
|
# DB接続情報書き換え
|
||||||
|
sed -i -e "s/DB_NAME/$(db-name)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_PASS/$(db-pass)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_USERNAME/$(db-user)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_PORT/$(db-port)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_HOST/$(db-host)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
/home/azureuser/go/bin/sql-migrate --version
|
||||||
|
cat ./dictation_server/db/dbconfig.yml
|
||||||
|
# migration実行
|
||||||
|
/home/azureuser/go/bin/sql-migrate up -config=dictation_server/db/dbconfig.yml -env=ci
|
||||||
|
...
|
||||||
114
configurations/pipeline/ODMS Staging Deploy.yml
Normal file
114
configurations/pipeline/ODMS Staging Deploy.yml
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# Variable 'static_dictation_deployment_token' was defined in the Variables tab
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- refs/heads/develop
|
||||||
|
name: $(date:yyyyMMdd)$(rev:.r)
|
||||||
|
jobs:
|
||||||
|
- job: Job_1
|
||||||
|
displayName: Dictation App Service Deploy
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
fetchDepth: 2
|
||||||
|
- task: Npm@1
|
||||||
|
displayName: npm ci
|
||||||
|
inputs:
|
||||||
|
command: ci
|
||||||
|
workingDir: dictation_server
|
||||||
|
verbose: false
|
||||||
|
- task: AzureKeyVault@2
|
||||||
|
displayName: 'Azure Key Vault: kv-odms-secret-stg'
|
||||||
|
enabled: False
|
||||||
|
inputs:
|
||||||
|
ConnectedServiceName: 82047c72-0cfe-43b0-bb2f-cdfd8b165e68
|
||||||
|
KeyVaultName: kv-odms-secret-stg
|
||||||
|
SecretsFilter: token-public-key
|
||||||
|
- task: Bash@3
|
||||||
|
displayName: Bash Script (Test)
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
script: cd dictation_server && npm run test
|
||||||
|
- task: Docker@0
|
||||||
|
displayName: build
|
||||||
|
inputs:
|
||||||
|
azureSubscriptionEndpoint: 827be338-1846-4102-b006-f457c92883d3
|
||||||
|
azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}'
|
||||||
|
dockerFile: DockerfileServerDictation.dockerfile
|
||||||
|
imageName: $(Build.Repository.Name)/staging/dictation:latest
|
||||||
|
- task: Docker@0
|
||||||
|
displayName: Push
|
||||||
|
inputs:
|
||||||
|
azureSubscriptionEndpoint: 827be338-1846-4102-b006-f457c92883d3
|
||||||
|
azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}'
|
||||||
|
action: Push an image
|
||||||
|
imageName: $(Build.Repository.Name)/staging/dictation:latest
|
||||||
|
- job: Job_2
|
||||||
|
displayName: Dictation Static App Service Deploy
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
fetchDepth: 2
|
||||||
|
- task: Npm@1
|
||||||
|
displayName: npm ci
|
||||||
|
inputs:
|
||||||
|
command: ci
|
||||||
|
workingDir: dictation_client
|
||||||
|
verbose: false
|
||||||
|
- task: Bash@3
|
||||||
|
displayName: Bash Script
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
script: cd dictation_client && cp -f .env.staging .env && npm run build
|
||||||
|
- task: AzureStaticWebApp@0
|
||||||
|
displayName: 'Static Web App: '
|
||||||
|
inputs:
|
||||||
|
app_location: /dictation_client/build
|
||||||
|
config_file_location: /dictation_client
|
||||||
|
skip_app_build: true
|
||||||
|
skip_api_build: true
|
||||||
|
is_static_export: false
|
||||||
|
verbose: false
|
||||||
|
azure_static_web_apps_api_token: $(static_dictation_deployment_token)
|
||||||
|
- job: Job_3
|
||||||
|
displayName: DB migration
|
||||||
|
dependsOn:
|
||||||
|
- Job_1
|
||||||
|
- Job_2
|
||||||
|
pool:
|
||||||
|
name: db-migrate-pipelines
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
fetchDepth: 2
|
||||||
|
- task: GoTool@0
|
||||||
|
displayName: Use Go 1.18
|
||||||
|
inputs:
|
||||||
|
version: 1.18
|
||||||
|
- task: Go@0
|
||||||
|
displayName: go install
|
||||||
|
inputs:
|
||||||
|
command: custom
|
||||||
|
customCommand: install
|
||||||
|
arguments: github.com/rubenv/sql-migrate/sql-migrate@latest
|
||||||
|
- task: AzureKeyVault@2
|
||||||
|
displayName: 'Azure Key Vault: kv-odms-secret-stg'
|
||||||
|
inputs:
|
||||||
|
ConnectedServiceName: 82047c72-0cfe-43b0-bb2f-cdfd8b165e68
|
||||||
|
KeyVaultName: kv-odms-secret-stg
|
||||||
|
- task: CmdLine@2
|
||||||
|
displayName: migration
|
||||||
|
inputs:
|
||||||
|
script: >2
|
||||||
|
# DB接続情報書き換え
|
||||||
|
sed -i -e "s/DB_NAME/$(db-name)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_PASS/$(db-pass)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_USERNAME/$(db-user)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_PORT/$(db-port)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
sed -i -e "s/DB_HOST/$(db-host)/g" ./dictation_server/db/dbconfig.yml
|
||||||
|
/home/azureuser/go/bin/sql-migrate --version
|
||||||
|
cat ./dictation_server/db/dbconfig.yml
|
||||||
|
# migration実行
|
||||||
|
/home/azureuser/go/bin/sql-migrate up -config=dictation_server/db/dbconfig.yml -env=ci
|
||||||
|
...
|
||||||
Loading…
x
Reference in New Issue
Block a user