Skip to content

Commit 576abd9

Browse files
committed
backported schema download script from #313 to 3.x branch (#314)
closes #314
1 parent 57f4010 commit 576abd9

File tree

1 file changed

+11
-30
lines changed

1 file changed

+11
-30
lines changed
Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,28 @@
11
#!/usr/bin/env bash
22

3-
set -x
3+
set -ex
44

55
download_schema()
66
{
7-
from=$1
8-
to=$2
9-
10-
for run in {1..5}
7+
rm -rf ${1} && mkdir -p ${1}
8+
for run in 1 2 3 4 5
119
do
12-
curl -sf --compressed ${from} > ${to}
10+
curl --silent --fail https://codeload.github.com/elastic/apm-server/tar.gz/${2} | tar xzvf - --wildcards --directory=${1} --strip-components=1 "*/docs/spec/*"
1311
result=$?
1412
if [ $result -eq 0 ]; then break; fi
1513
sleep 1
1614
done
17-
1815
if [ $result -ne 0 ]; then exit $result; fi
16+
17+
mv -f ${1}/docs/spec/* ${1}/
18+
rm -rf ${1}/docs
19+
1920
}
2021

2122
# parent directory
2223
basedir=$(dirname "$0")/..
2324

24-
FILES=( \
25-
"errors/error.json" \
26-
"errors/payload.json" \
27-
"sourcemaps/payload.json" \
28-
"transactions/mark.json" \
29-
"transactions/payload.json" \
30-
"transactions/span.json" \
31-
"transactions/transaction.json" \
32-
"context.json" \
33-
"process.json" \
34-
"request.json" \
35-
"service.json" \
36-
"stacktrace_frame.json" \
37-
"system.json" \
38-
"tags.json" \
39-
"user.json" \
40-
)
41-
42-
mkdir -p ${basedir}/.schemacache/errors ${basedir}/.schemacache/transactions ${basedir}/.schemacache/sourcemaps
43-
44-
for i in "${FILES[@]}"; do
45-
download_schema https://raw.githubusercontent.com/elastic/apm-server/6.x/docs/spec/${i} ${basedir}/.schemacache/${i}
46-
done
25+
26+
download_schema ${basedir}/.schemacache 6.4
27+
4728
echo "Done."

0 commit comments

Comments
 (0)