blob: f7313bc37142c86dc30b6b3b5808a280568709c9 (
plain) (
blame)
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
|
#!/usr/bin/env sh
# $BUILDKITE_API_TOKEN must be set.
if [ -z "$BUILDKITE_API_TOKEN" ]; then
echo 'Error: $BUILDKITE_API_TOKEN is empty or not set.' 1>&2
exit 1
fi
BASE_URL=https://api.buildkite.com/v2/organizations/ninenines
_download() {
for f in pipelines/*
do
curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
"$BASE_URL/$f" > $f
done
}
_upload() {
for f in pipelines/*
do
curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \
-X PATCH --data-binary @$f "$BASE_URL/$f"
done
}
case "$1" in
download)
_download
;;
upload)
_upload
;;
*)
echo "Unknown command: $1"
exit 1
;;
esac
|