-
Notifications
You must be signed in to change notification settings - Fork 7
158 lines (142 loc) · 5.65 KB
/
deploy_prd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Manual Production Deploy
run-name: 'Manual Production Deploy ${{ github.event.inputs.version }}'
concurrency: Manual Production Deploy
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
jobs:
deploy_to_production_start_slack:
if: github.repository_owner == 'Informatievlaanderen'
name: Deploy to production started
environment: prd
runs-on: ubuntu-latest
steps:
- name: Parse repository name
run: echo REPOSITORY_NAME=$(echo ""$GITHUB_REPOSITORY"" | awk -F / '{print $2}' | sed -e ""s/:refs//"") >> $GITHUB_ENV
shell: bash
- name: Notify deployment started
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: '#team-dinosaur-dev'
slack-message: Deployment of parcel-registry to production has started
env:
SLACK_BOT_TOKEN: ${{ secrets.VBR_SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.VBR_NOTIFIER_CHANNEL_NAME }}
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }}
deploy_services_to_production:
if: github.repository_owner == 'Informatievlaanderen'
needs: [ deploy_to_production_start_slack ]
name: Deploy to Production
runs-on: ubuntu-latest
strategy:
matrix:
services: [
'parcel-api',
'parcel-backoffice-api',
'parcel-consumer-address',
'parcel-producer',
'parcel-producer-snapshot-oslo',
'parcel-projections',
'parcel-projections-backoffice'
]
steps:
- name: CD services
env:
BUILD_URL: ${{ vars.VBR_AWS_BUILD_API_DEVOPS }}/${{matrix.services}}
STATUS_URL: ${{ vars.VBR_AWS_BUILD_STATUS_API_DEVOPS }}/${{matrix.services}}
uses: informatievlaanderen/awscurl-polling-action/polling-action@main
with:
environment: prd
version: ${{ github.event.inputs.version }}
status-url: $STATUS_URL
deploy-url: $BUILD_URL
access-key: ${{ secrets.VBR_AWS_ACCESS_KEY_ID_DEVOPS }}
secret-key: ${{ secrets.VBR_AWS_SECRET_ACCESS_KEY_DEVOPS }}
interval: 2
deploy-target: 'agb_ecs_service'
domain: 'basisregisters'
project: 'basisregisters'
- name: output CD services
shell: bash
run: |
echo build-uuid: ${{ steps.awscurl-polling-action.outputs.build-uuid }}
echo Status: ${{ steps.awscurl-polling-action.outputs.status }}
echo ${{ steps.awscurl-polling-action.outputs.final-message }}
deploy_tasks_to_production:
if: github.repository_owner == 'Informatievlaanderen'
needs: [ deploy_to_production_start_slack ]
name: Deploy to Production
runs-on: ubuntu-latest
strategy:
matrix:
services: [
#'parcel-migrator-parcel',
'parcel-importer-grb',
'parcel-snapshot-verifier'
]
steps:
- name: CD tasks
env:
BUILD_URL: ${{ vars.VBR_AWS_BUILD_API_DEVOPS }}/${{matrix.services}}
STATUS_URL: ${{ vars.VBR_AWS_BUILD_STATUS_API_DEVOPS }}/${{matrix.services}}
uses: informatievlaanderen/awscurl-polling-action/polling-action@main
with:
environment: prd
version: ${{ github.event.inputs.version }}
status-url: $STATUS_URL
deploy-url: $BUILD_URL
access-key: ${{ secrets.VBR_AWS_ACCESS_KEY_ID_DEVOPS }}
secret-key: ${{ secrets.VBR_AWS_SECRET_ACCESS_KEY_DEVOPS }}
interval: 2
deploy-target: 'ecs_scheduled_task'
domain: 'basisregisters'
project: 'basisregisters'
- name: output CD tasks
shell: bash
run: |
echo build-uuid: ${{ steps.awscurl-polling-action.outputs.build-uuid }}
echo Status: ${{ steps.awscurl-polling-action.outputs.status }}
echo ${{ steps.awscurl-polling-action.outputs.final-message }}
deploy_lambda_to_production:
if: github.repository_owner == 'Informatievlaanderen'
needs: [deploy_services_to_production, deploy_tasks_to_production]
name: Deploy lambda to production
runs-on: ubuntu-latest
steps:
- name: CD Lambda(s) Configure credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-access-key-id: ${{ secrets.VBR_AWS_ACCESS_KEY_ID_DEVOPS }}
aws-secret-access-key: ${{ secrets.VBR_AWS_SECRET_ACCESS_KEY_DEVOPS }}
aws-region: ${{ secrets.VBR_AWS_REGION_PRD }}
- name: Promote Lambda(s)
uses: Informatievlaanderen/build-pipeline/.github/actions/deploy-lambda-v4@main
with:
function-name: par-sqsbackofficefunction
deploy-url: ${{ vars.VBR_AWS_DEPLOY_LAMBDA_DEVOPS_BASEURL }}
access-key-id: ${{ secrets.VBR_AWS_ACCESS_KEY_ID_DEVOPS }}
secret-access-key-id: ${{ secrets.VBR_AWS_SECRET_ACCESS_KEY_DEVOPS }}
region: ${{ secrets.VBR_AWS_REGION_PRD }}
version: ${{ github.event.inputs.version }}
environment: prd
deploy_to_production_finish_1:
if: github.repository_owner == 'Informatievlaanderen'
needs: [ deploy_lambda_to_production ]
name: Deploy to production finished
runs-on: ubuntu-latest
steps:
- name: Parse repository name
run: echo REPOSITORY_NAME=$(echo ""$GITHUB_REPOSITORY"" | awk -F / '{print $2}' | sed -e ""s/:refs//"") >> $GITHUB_ENV
shell: bash
- name: Notify deployment finished
uses: slackapi/slack-github-action@v1.25.0
with:
channel-id: '#team-dinosaur-dev'
slack-message: Deployment of parcel-registry to production has finished
env:
SLACK_BOT_TOKEN: ${{ secrets.VBR_SLACK_BOT_TOKEN }}
SLACK_CHANNEL: ${{ secrets.VBR_NOTIFIER_CHANNEL_NAME }}
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }}