-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfile.yml
More file actions
260 lines (233 loc) · 8.68 KB
/
Taskfile.yml
File metadata and controls
260 lines (233 loc) · 8.68 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
# https://taskfile.dev
version: "3"
vars:
CONNECTOR_INTERNAL_DEBUG_PORT: 8787
env:
MAIN_IP_ADDRESS:
sh: ip route get 1.2.3.4 | awk '{print $7}'
CONNECTOR_DIR: connector
SCRIPTS_IMAGE: edc-poc-scripts
EDCPY_IMAGE: edcpy
EXAMPLE_CONSUMER_CERTS_DIR: "{{.ROOT_DIR}}/dev-config/certs-consumer"
EXAMPLE_PROVIDER_CERTS_DIR: "{{.ROOT_DIR}}/dev-config/certs-provider"
KEY_ALIAS: datacellar
KEY_PASSW: datacellar
EDC_VENV: "{{.ROOT_DIR}}/.venv-examples"
API_AUTH_KEY: datacellar
API_AUTH_KEY_ALIAS: apikey
BACKEND_API_KEY: secret-api-key-value
tasks:
clean:
desc: Removes all generated artifacts, containers, and temporary files from previous task executions
cmds:
- docker compose -f {{.ROOT_DIR}}/docker-compose-dev.yml down -v
- docker compose -f {{.ROOT_DIR}}/mock-backend/docker-compose.yml down -v
- rm -fr {{.EXAMPLE_CONSUMER_CERTS_DIR}}
- rm -fr {{.EXAMPLE_PROVIDER_CERTS_DIR}}
- cd {{.CONNECTOR_DIR}} && gradle clean
- cmd: docker rmi -f {{.SCRIPTS_IMAGE}}
ignore_error: true
- cmd: docker rmi -f {{.EDCPY_IMAGE}}
ignore_error: true
build-scripts-image:
desc: Creates a Docker image containing utility scripts for certificate and vault management
dir: scripts
cmds:
- docker build -t {{.SCRIPTS_IMAGE}} .
build-connector:
desc: Compiles and packages the EDC connector with configurable features (SSI, SQL storage, Federated Catalog)
dir: "{{.CONNECTOR_DIR}}"
vars:
CLEAN: '{{default "true" .CLEAN}}'
SSI: '{{default "false" .SSI}}'
SQL: '{{default "false" .SQL}}'
CATALOG: '{{default "false" .CATALOG}}'
env:
# https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties
ORG_GRADLE_PROJECT_useSSI: "{{.SSI}}"
ORG_GRADLE_PROJECT_useSQLStore: "{{.SQL}}"
ORG_GRADLE_PROJECT_enableFederatedCatalog: "{{.CATALOG}}"
cmds:
- gradle {{if eq .CLEAN "true"}}clean{{end}} build
build-edcpy-image:
desc: Creates a Docker image containing the EDC Python SDK and its dependencies
cmds:
- docker build -t {{.EDCPY_IMAGE}} -f Dockerfile.edcpy .
create-certs:
deps:
- build-scripts-image
requires:
vars: [CERTS_DIR]
cmds:
- mkdir -p {{.CERTS_DIR}}
- >
docker run --rm
-v {{.CERTS_DIR}}:/out
-e OUT_DIR=/out
-e KEY_ALIAS={{.KEY_ALIAS}}
-e KEY_PASSW={{.KEY_PASSW}}
{{.SCRIPTS_IMAGE}}
/root/create-certs.sh
status:
- test -f {{.CERTS_DIR}}/*.pfx
create-example-certs-consumer:
desc: Generates SSL certificates for securing the example consumer's communications
cmds:
- task: create-certs
vars:
CERTS_DIR: "{{.EXAMPLE_CONSUMER_CERTS_DIR}}"
create-example-certs-provider:
desc: Generates SSL certificates for securing the example provider's communications
cmds:
- task: create-certs
vars:
CERTS_DIR: "{{.EXAMPLE_PROVIDER_CERTS_DIR}}"
generate-vault:
deps:
- build-scripts-image
requires:
vars: [CERTS_DIR]
cmds:
- >
docker run --rm
-v {{.CERTS_DIR}}:/out
-e OUT_DIR=/out
-e KEYSTORE_PATH=/out/cert.pfx
-e KEYSTORE_PASSWORD={{.KEY_PASSW}}
-e API_AUTH_KEY={{.API_AUTH_KEY}}
-e API_AUTH_KEY_ALIAS={{.API_AUTH_KEY_ALIAS}}
{{.SCRIPTS_IMAGE}}
/root/generate-vault.sh
status:
- test -f {{.CERTS_DIR}}/vault.properties
preconditions:
- test -f {{.CERTS_DIR}}/cert.pfx
generate-vault-example-consumer:
deps:
- create-example-certs-consumer
desc: Creates a vault properties file for the example consumer using its certificates
cmds:
- task: generate-vault
vars:
CERTS_DIR: "{{.EXAMPLE_CONSUMER_CERTS_DIR}}"
generate-vault-example-provider:
deps:
- create-example-certs-provider
desc: Creates a vault properties file for the example provider using its certificates
cmds:
- task: generate-vault
vars:
CERTS_DIR: "{{.EXAMPLE_PROVIDER_CERTS_DIR}}"
up-provider-mock-api:
desc: Launches a mock HTTP API that simulates the provider's data services
cmds:
- >
docker compose
-f {{.ROOT_DIR}}/mock-backend/docker-compose.yml
up -d --build --wait
provision-example-provider:
desc: Sets up a complete example provider environment with certificates, vault, and mock API
cmds:
- task: generate-vault-example-provider
- task: up-provider-mock-api
- >
docker compose
-f {{.ROOT_DIR}}/docker-compose-box-provider.yml
up -d --build --wait
provision-example-consumer:
desc: Sets up a complete example consumer environment with certificates and vault
cmds:
- task: generate-vault-example-consumer
- >
docker compose
-f {{.ROOT_DIR}}/docker-compose-box-consumer.yml
up -d --build --wait
provision-example-virtualenv:
desc: Creates and configures a Python virtual environment with the edcpy library installed
cmds:
- rm -fr {{.EDC_VENV}}
- virtualenv {{.EDC_VENV}}
- "{{.EDC_VENV}}/bin/pip install --upgrade pip"
- "{{.EDC_VENV}}/bin/pip install --upgrade {{.ROOT_DIR}}/edcpy"
status:
- test -f {{.EDC_VENV}}/bin/python
run-example-pull:
desc: Runs the consumer pull example script demonstrating consumer-initiated data transfer
deps:
- provision-example-virtualenv
cmds:
- "{{.EDC_VENV}}/bin/python {{.ROOT_DIR}}/example/example_pull.py"
run-example-push:
desc: Runs the provider push example script demonstrating provider-initiated data transfer
deps:
- provision-example-virtualenv
cmds:
- "{{.EDC_VENV}}/bin/python {{.ROOT_DIR}}/example/example_push.py"
run-example-parallel:
desc: Runs the parallel example script for concurrent data transfers to the same connector
deps:
- provision-example-virtualenv
cmds:
- "{{.EDC_VENV}}/bin/python {{.ROOT_DIR}}/example/example_parallel.py"
run-example-pull-sse:
desc: Runs the consumer pull example script demonstrating the SSE endpoints for pull transfers
deps:
- provision-example-virtualenv
cmds:
- "{{.EDC_VENV}}/bin/python {{.ROOT_DIR}}/example/example_pull_sse.py"
run-example-push-sse:
desc: Runs the provider push example script demonstrating the SSE endpoints for push transfers
deps:
- provision-example-virtualenv
cmds:
- "{{.EDC_VENV}}/bin/python {{.ROOT_DIR}}/example/example_push_sse.py"
dev-up:
desc: Launches the complete development environment with configurable connector features
deps:
- generate-vault-example-consumer
- generate-vault-example-provider
vars:
CLEAN: '{{default "false" .CLEAN}}'
SSI: '{{default "false" .SSI}}'
SQL: '{{default "false" .SQL}}'
DEBUG: '{{default "false" .DEBUG}}'
CATALOG: '{{default "false" .CATALOG}}'
env:
JAVA_TOOL_OPTIONS: '{{if eq .DEBUG "true"}}-agentlib:jdwp=transport=dt_socket,address=*:{{.CONNECTOR_INTERNAL_DEBUG_PORT}},server=y,suspend=n{{end}}'
cmds:
- docker compose -f {{.ROOT_DIR}}/mock-backend/docker-compose.yml up -d --build --wait
- task: build-connector
vars:
CLEAN: "{{.CLEAN}}"
SSI: "{{.SSI}}"
CATALOG: "{{.CATALOG}}"
- docker compose -f {{.ROOT_DIR}}/docker-compose-dev.yml up --force-recreate -d --build --wait
dev-down:
desc: Stops and removes all development environment containers and volumes
cmds:
- docker compose -f {{.ROOT_DIR}}/docker-compose-dev.yml down -v
- docker compose -f {{.ROOT_DIR}}/mock-backend/docker-compose.yml down -v
dev-provision-wallets-venv:
cmds:
- virtualenv --python python3 {{.ROOT_DIR}}/scripts/.venv
- "{{.ROOT_DIR}}/scripts/.venv/bin/pip install --upgrade pip"
- "{{.ROOT_DIR}}/scripts/.venv/bin/pip install --upgrade -r {{.ROOT_DIR}}/scripts/requirements.txt"
status:
- test -d {{.ROOT_DIR}}/scripts/.venv
dev-provision-wallets:
desc: Creates and configures digital wallets for SSI functionality in the development environment
deps:
- dev-provision-wallets-venv
dotenv:
- dev-config/.env.dev.wallets
- dev-config/.env.dev.wallets.local
cmds:
- "{{.ROOT_DIR}}/scripts/.venv/bin/python {{.ROOT_DIR}}/scripts/provision-wallets.py"
test-federated-catalog-query:
desc: Tests the federated catalog functionality by sending a query and displaying the JSON response
cmds:
- >
curl -d @{{.ROOT_DIR}}/dev-config/empty-catalog-query.json
-H 'content-type: application/json'
-H 'x-api-key: {{.API_AUTH_KEY}}'
http://localhost:19193/management/federatedcatalog | jq