From 877920e61b18f95fece52f9e1f58eab562682057 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 17 Aug 2018 21:16:04 -0700 Subject: [PATCH] Compute snap channel using ci/channel-info.sh --- ci/snap.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ci/snap.sh b/ci/snap.sh index 26daa6a07..74d03198c 100755 --- a/ci/snap.sh +++ b/ci/snap.sh @@ -7,18 +7,21 @@ if [[ -z $BUILDKITE_BRANCH ]] || ./ci/is-pr.sh; then DRYRUN="echo" fi -# BUILDKITE_TAG is the normal environment variable set by Buildkite. However -# when this script is run from a triggered pipeline, TRIGGERED_BUILDKITE_TAG is -# used instead of BUILDKITE_TAG (due to Buildkite limitations that prevents -# BUILDKITE_TAG from propagating through to triggered pipelines) -if [[ -n "$BUILDKITE_TAG" || -n "$TRIGGERED_BUILDKITE_TAG" ]]; then +eval "$(ci/channel-info.sh)" + +if [[ $BUILDKITE_BRANCH = "$STABLE_CHANNEL" ]]; then SNAP_CHANNEL=stable -elif [[ $BUILDKITE_BRANCH = master ]]; then +elif [[ $BUILDKITE_BRANCH = "$EDGE_CHANNEL" ]]; then SNAP_CHANNEL=edge -else +elif [[ $BUILDKITE_BRANCH = "$BETA_CHANNEL" ]]; then SNAP_CHANNEL=beta fi +if [[ -z $SNAP_CHANNEL ]]; then + echo Unable to determine channel to publish into, exiting. + exit 0 +fi + if [[ -z $DRYRUN ]]; then [[ -n $SNAPCRAFT_CREDENTIALS_KEY ]] || { echo SNAPCRAFT_CREDENTIALS_KEY not defined