2018-11-24 11:11:27 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
if [[ -z $BUILDKITE ]]; then
|
|
|
|
echo BUILDKITE not defined
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-22 14:16:29 -08:00
|
|
|
if [[ -z $PUBLISH_CHANNEL ]]; then
|
|
|
|
PUBLISH_CHANNEL=$(buildkite-agent meta-data get "channel" --default "")
|
2018-11-24 11:11:27 -08:00
|
|
|
fi
|
|
|
|
|
2019-01-22 14:16:29 -08:00
|
|
|
if [[ -z $PUBLISH_CHANNEL ]]; then
|
2018-11-24 11:11:27 -08:00
|
|
|
(
|
|
|
|
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)"
|
|
|
|
|
2019-01-22 14:16:29 -08:00
|
|
|
case $PUBLISH_CHANNEL in
|
2018-11-24 11:11:27 -08:00
|
|
|
edge)
|
|
|
|
CHANNEL_BRANCH=$EDGE_CHANNEL
|
|
|
|
;;
|
|
|
|
beta)
|
|
|
|
CHANNEL_BRANCH=$BETA_CHANNEL
|
|
|
|
;;
|
|
|
|
stable)
|
2019-03-11 16:19:16 -07:00
|
|
|
CHANNEL_BRANCH=$STABLE_CHANNEL
|
2018-11-24 11:11:27 -08:00
|
|
|
;;
|
|
|
|
*)
|
2019-01-22 14:16:29 -08:00
|
|
|
echo "Error: Invalid PUBLISH_CHANNEL=$PUBLISH_CHANNEL"
|
2018-11-24 11:11:27 -08:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ $BUILDKITE_BRANCH != "$CHANNEL_BRANCH" ]]; then
|
|
|
|
(
|
|
|
|
cat <<EOF
|
|
|
|
steps:
|
|
|
|
- trigger: "$BUILDKITE_PIPELINE_SLUG"
|
|
|
|
async: true
|
|
|
|
build:
|
|
|
|
message: "$BUILDKITE_MESSAGE"
|
|
|
|
branch: "$CHANNEL_BRANCH"
|
|
|
|
env:
|
2019-01-22 14:16:29 -08:00
|
|
|
PUBLISH_CHANNEL: "$PUBLISH_CHANNEL"
|
2018-11-24 11:11:27 -08:00
|
|
|
EOF
|
|
|
|
) | buildkite-agent pipeline upload
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -x
|
2019-01-22 14:16:29 -08:00
|
|
|
exec metrics/publish-metrics-dashboard.sh "$PUBLISH_CHANNEL"
|