forked from UW-GAC/anvil-util-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_md5.wdl
43 lines (35 loc) · 926 Bytes
/
check_md5.wdl
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
version 1.0
workflow check_md5 {
input {
String file
String md5sum
}
call results {
input: file = file,
md5sum = md5sum
}
output {
String md5_check = results.md5_check
}
meta {
author: "Stephanie Gogarten"
email: "[email protected]"
}
}
task results {
input {
String file
String md5sum
}
command <<<
gsutil ls -L ~{file} | grep "md5" | awk '{print $3}' > md5_b64.txt
python3 -c "import base64; import binascii; print(binascii.hexlify(base64.urlsafe_b64decode(open('md5_b64.txt').read())))" | cut -d "'" -f 2 > md5_hex.txt
python3 -c "print('PASS' if open('md5_hex.txt').read().strip() == '~{md5sum}' else 'FAIL')" > check.txt
>>>
output {
String md5_check = read_string("check.txt")
}
runtime {
docker: "google/cloud-sdk:slim"
}
}