forked from PolymathNetwork/Polymath-Tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azureUpdate.sh
executable file
·44 lines (41 loc) · 1002 Bytes
/
azureUpdate.sh
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
#!/bin/bash
if [[ -z $FILE || -z $PAT || -z $WORK_ITEM ]]; then
echo "Usage: FILE=<feature file> PAT=<pat> WORK_ITEM=<work item> ./azureUpdate.sh"
exit 1
fi
name=${FILE//\//.}
name=${name//\\/.}
read -r -d '' body <<EOM
[
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestName",
"value": "${name}"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestStorage",
"value": "${FILE}"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestId",
"value": "$(uuidgen)"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestType",
"value": "Unit Test"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomationStatus",
"value": "Automated"
}
]
EOM
curl -s -f -v -X PATCH \
-H "Content-Type: application/json-patch+json" \
-u "xxx:$PAT" \
-d "$body" \
"https://dev.azure.com/polymathnetwork/_apis/wit/workitems/$WORK_ITEM?api-version=2.0"