-
Notifications
You must be signed in to change notification settings - Fork 165
/
publish-metrics-dashboard.sh
executable file
·74 lines (65 loc) · 1.33 KB
/
publish-metrics-dashboard.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
if [[ -z $BUILDKITE ]]; then
echo BUILDKITE not defined
exit 1
fi
if [[ -z $PUBLISH_CHANNEL ]]; then
PUBLISH_CHANNEL=$(buildkite-agent meta-data get "channel" --default "")
fi
if [[ -z $PUBLISH_CHANNEL ]]; then
(
cat <<EOF
steps:
- block: "Select Dashboard"
fields:
- select: "Channel"
key: "channel"
options:
- label: "stable"
value: "stable"
- label: "edge"
value: "edge"
- label: "beta"
value: "beta"
- command: "ci/$(basename "$0")"
EOF
) | buildkite-agent pipeline upload
exit 0
fi
ci/channel-info.sh
eval "$(ci/channel-info.sh)"
case $PUBLISH_CHANNEL in
edge)
CHANNEL_BRANCH=$EDGE_CHANNEL
;;
beta)
CHANNEL_BRANCH=$BETA_CHANNEL
;;
stable)
# Set to whatever branch 'testnet' is on.
CHANNEL_BRANCH=$BETA_CHANNEL
;;
*)
echo "Error: Invalid PUBLISH_CHANNEL=$PUBLISH_CHANNEL"
exit 1
;;
esac
if [[ $CI_BRANCH != "$CHANNEL_BRANCH" ]]; then
(
cat <<EOF
steps:
- trigger: "$BUILDKITE_PIPELINE_SLUG"
async: true
build:
message: "$BUILDKITE_MESSAGE"
branch: "$CHANNEL_BRANCH"
env:
PUBLISH_CHANNEL: "$PUBLISH_CHANNEL"
EOF
) | buildkite-agent pipeline upload
exit 0
fi
set -x
exec metrics/publish-metrics-dashboard.sh "$PUBLISH_CHANNEL"