-
Notifications
You must be signed in to change notification settings - Fork 2.1k
266 lines (251 loc) · 11 KB
/
kms-connector-docker-build.yml
File metadata and controls
266 lines (251 loc) · 11 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: kms-connector-docker-build
on:
workflow_call:
secrets:
AWS_ACCESS_KEY_S3_USER:
required: true
AWS_SECRET_KEY_S3_USER:
required: true
BLOCKCHAIN_ACTIONS_TOKEN:
required: true
GHCR_READ_TOKEN:
required: true
CGR_USERNAME:
required: true
CGR_PASSWORD:
required: true
outputs:
db_migration_build_result:
description: "Result of the build-db-migration job"
value: ${{ jobs.build-db-migration.result }}
gw_listener_build_result:
description: "Result of the build-gw-listener job"
value: ${{ jobs.build-gw-listener.result }}
kms_worker_build_result:
description: "Result of the build-kms-worker job"
value: ${{ jobs.build-kms-worker.result }}
tx_sender_build_result:
description: "Result of the build-tx-sender job"
value: ${{ jobs.build-tx-sender.result }}
release:
types:
- published
workflow_dispatch:
inputs:
build_db_migration:
description: "Enable/disable build for KMS Connector's DB Migration"
type: boolean
default: true
build_gw_listener:
description: "Enable/disable build for KMS Connector's Gateway Listener"
type: boolean
default: true
build_kms_worker:
description: "Enable/disable build for KMS Connector's KMS Worker"
type: boolean
default: true
build_tx_sender:
description: "Enable/disable build for KMS Connector's Transaction Sender"
type: boolean
default: true
push:
branches:
- main
permissions: {}
concurrency:
group: kms-connector-build-${{ github.ref_name }}
cancel-in-progress: true
jobs:
########################################################################
# DB MIGRATION #
########################################################################
check-changes-db-migration:
uses: ./.github/workflows/check-changes-for-docker-build.yml
secrets: &check_changes_secrets
GHCR_READ_TOKEN: ${{ secrets.GHCR_READ_TOKEN }}
permissions: &check_changes_permissions
actions: 'read' # Required to read workflow run information
contents: 'read' # Required to checkout repository code
pull-requests: 'read' # Required to read pull request information
with:
caller-workflow-event-name: ${{ github.event_name }}
caller-workflow-event-before: ${{ github.event.before }}
docker-image: fhevm/kms-connector/db-migration
filters: |
db-migration:
- .github/workflows/kms-connector-docker-build.yml
- kms-connector/connector-db/**
build-db-migration:
needs: check-changes-db-migration
if: |
github.event_name == 'release'
|| (github.event_name != 'workflow_dispatch' && needs.check-changes-db-migration.outputs.changes == 'true')
|| (github.event_name == 'workflow_dispatch' && inputs.build_db_migration)
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@3cf4c2b133947d29e7a313555638621f9ca0345c # v1.0.3
secrets: &docker_secrets
AWS_ACCESS_KEY_S3_USER: ${{ secrets.AWS_ACCESS_KEY_S3_USER }}
AWS_SECRET_KEY_S3_USER: ${{ secrets.AWS_SECRET_KEY_S3_USER }}
BLOCKCHAIN_ACTIONS_TOKEN: ${{ secrets.BLOCKCHAIN_ACTIONS_TOKEN }}
CGR_USERNAME: ${{ secrets.CGR_USERNAME }}
CGR_PASSWORD: ${{ secrets.CGR_PASSWORD }}
permissions: &docker_permissions
actions: 'read' # Required to read workflow run information
contents: 'read' # Required to checkout repository code
pull-requests: 'read' # Required to read pull request information
attestations: 'write' # Required to create build attestations
packages: 'write' # Required to publish Docker images
id-token: 'write' # Required for OIDC authentication
with:
use-cgr-secrets: true
working-directory: "."
image-name: "fhevm/kms-connector/db-migration"
docker-file: "kms-connector/connector-db/Dockerfile"
app-cache-dir: "fhevm-kms-connector-db-migration"
rust-toolchain-file-path: kms-connector/rust-toolchain.toml
re-tag-db-migration-image:
needs: check-changes-db-migration
if: |
needs.check-changes-db-migration.outputs.changes != 'true' && github.event_name == 'push'
permissions: &re-tag-image-permissions
actions: 'read' # Required to read workflow run information
contents: 'read' # Required to checkout repository code
packages: 'write' # Required to publish Docker images
id-token: 'write' # Required for OIDC authentication
uses: ./.github/workflows/re-tag-docker-image.yml
with:
image-name: "fhevm/kms-connector/db-migration"
previous-tag-or-commit: ${{ needs.check-changes-db-migration.outputs.base-commit }}
new-tag-or-commit: ${{ github.event.after }}
########################################################################
# GATEWAY LISTENER #
########################################################################
check-changes-gw-listener:
uses: ./.github/workflows/check-changes-for-docker-build.yml
secrets: *check_changes_secrets
permissions: *check_changes_permissions
with:
caller-workflow-event-name: ${{ github.event_name }}
caller-workflow-event-before: ${{ github.event.before }}
docker-image: fhevm/kms-connector/gw-listener
filters: |
gw-listener:
- .github/workflows/kms-connector-docker-build.yml
- kms-connector/crates/gw-listener/**
- kms-connector/crates/utils/**
- kms-connector/Cargo.*
- gateway-contracts/rust-bindings/**
build-gw-listener:
needs: check-changes-gw-listener
if: |
github.event_name == 'release'
|| (github.event_name != 'workflow_dispatch' && needs.check-changes-gw-listener.outputs.changes == 'true')
|| (github.event_name == 'workflow_dispatch' && inputs.build_gw_listener)
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@3cf4c2b133947d29e7a313555638621f9ca0345c # v1.0.3
permissions: *docker_permissions
secrets: *docker_secrets
with:
use-cgr-secrets: true
working-directory: "."
image-name: "fhevm/kms-connector/gw-listener"
docker-file: "./kms-connector/crates/gw-listener/Dockerfile"
app-cache-dir: "fhevm-kms-connector-gw-listener"
rust-toolchain-file-path: kms-connector/rust-toolchain.toml
re-tag-gw-listener-image:
needs: check-changes-gw-listener
if: |
needs.check-changes-gw-listener.outputs.changes != 'true' && github.event_name == 'push'
permissions: *re-tag-image-permissions
uses: ./.github/workflows/re-tag-docker-image.yml
with:
image-name: "fhevm/kms-connector/gw-listener"
previous-tag-or-commit: ${{ needs.check-changes-gw-listener.outputs.base-commit }}
new-tag-or-commit: ${{ github.event.after }}
########################################################################
# KMS WORKER #
########################################################################
check-changes-kms-worker:
uses: ./.github/workflows/check-changes-for-docker-build.yml
secrets: *check_changes_secrets
permissions: *check_changes_permissions
with:
caller-workflow-event-name: ${{ github.event_name }}
caller-workflow-event-before: ${{ github.event.before }}
docker-image: fhevm/kms-connector/kms-worker
filters: |
kms-worker:
- .github/workflows/kms-connector-docker-build.yml
- kms-connector/crates/kms-worker/**
- kms-connector/crates/utils/**
- kms-connector/Cargo.*
- gateway-contracts/rust-bindings/**
- host-contracts/rust-bindings/**
build-kms-worker:
needs: check-changes-kms-worker
if: |
github.event_name == 'release'
|| (github.event_name != 'workflow_dispatch' && needs.check-changes-kms-worker.outputs.changes == 'true')
|| (github.event_name == 'workflow_dispatch' && inputs.build_kms_worker)
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@3cf4c2b133947d29e7a313555638621f9ca0345c # v1.0.3
permissions: *docker_permissions
secrets: *docker_secrets
with:
use-cgr-secrets: true
working-directory: "."
image-name: "fhevm/kms-connector/kms-worker"
docker-file: "./kms-connector/crates/kms-worker/Dockerfile"
app-cache-dir: "fhevm-kms-connector-kms-worker"
rust-toolchain-file-path: kms-connector/rust-toolchain.toml
re-tag-kms-worker-image:
needs: check-changes-kms-worker
if: |
needs.check-changes-kms-worker.outputs.changes != 'true' && github.event_name == 'push'
permissions: *re-tag-image-permissions
uses: ./.github/workflows/re-tag-docker-image.yml
with:
image-name: "fhevm/kms-connector/kms-worker"
previous-tag-or-commit: ${{ needs.check-changes-kms-worker.outputs.base-commit }}
new-tag-or-commit: ${{ github.event.after }}
########################################################################
# TRANSACTION SENDER #
########################################################################
check-changes-tx-sender:
uses: ./.github/workflows/check-changes-for-docker-build.yml
secrets: *check_changes_secrets
permissions: *check_changes_permissions
with:
caller-workflow-event-name: ${{ github.event_name }}
caller-workflow-event-before: ${{ github.event.before }}
docker-image: fhevm/kms-connector/tx-sender
filters: |
tx-sender:
- .github/workflows/kms-connector-docker-build.yml
- kms-connector/crates/tx-sender/**
- kms-connector/crates/utils/**
- kms-connector/Cargo.*
- gateway-contracts/rust-bindings/**
build-tx-sender:
needs: check-changes-tx-sender
if: |
github.event_name == 'release'
|| (github.event_name != 'workflow_dispatch' && needs.check-changes-tx-sender.outputs.changes == 'true')
|| (github.event_name == 'workflow_dispatch' && inputs.build_tx_sender)
uses: zama-ai/ci-templates/.github/workflows/common-docker.yml@3cf4c2b133947d29e7a313555638621f9ca0345c # v1.0.3
permissions: *docker_permissions
secrets: *docker_secrets
with:
use-cgr-secrets: true
working-directory: "."
image-name: "fhevm/kms-connector/tx-sender"
docker-file: "./kms-connector/crates/tx-sender/Dockerfile"
app-cache-dir: "fhevm-kms-connector-tx-sender"
rust-toolchain-file-path: kms-connector/rust-toolchain.toml
re-tag-tx-sender-image:
needs: check-changes-tx-sender
if: |
needs.check-changes-tx-sender.outputs.changes != 'true' && github.event_name == 'push'
permissions: *re-tag-image-permissions
uses: ./.github/workflows/re-tag-docker-image.yml
with:
image-name: "fhevm/kms-connector/tx-sender"
previous-tag-or-commit: ${{ needs.check-changes-tx-sender.outputs.base-commit }}
new-tag-or-commit: ${{ github.event.after }}