-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.yaml
46 lines (45 loc) · 1.27 KB
/
workflow.yaml
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
main:
params: [input]
steps:
- init:
assign:
- projectId: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
- instance: ${input.instance}
- database: ${input.database}
- bucket: ${input.bucket}
- startSqlExport:
call: googleapis.sqladmin.v1beta4.instances.export
args:
project: ${projectId}
instance: ${instance}
body:
exportContext:
fileType: SQL
uri: ${"gs://" + bucket + "/" + database + ".sql.gz"}
databases:
- ${database}
offload: false
result: sqlExportOperation
- checkOperation:
call: googleapis.sqladmin.v1beta4.operations.get
args:
operation: ${sqlExportOperation.name}
project: ${projectId}
result: jobStatus
- checkIfDone:
switch:
- condition: ${jobStatus.status == "DONE"}
next: done
- condition: ${jobStatus.error}
raise:
code: 55
message: "SQL export operation failed"
- condition: true
next: wait
- wait:
call: sys.sleep
args:
seconds: 5
next: checkOperation
- done:
return: ${jobStatus}