Skip to content

Commit

Permalink
Fix unbound variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Nov 3, 2017
1 parent 8d3d92d commit 594a33a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .circleci/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ IFS=$'\n\t'

CURL_URL="https://registry.hub.docker.com/u/rocketchat/rocket.chat/trigger/$DOCKER_TRIGGER_TOKEN/"

if [[ $CIRCLE_TAG ]]
then
if [[ "${CIRCLE_TAG+SET}" = "SET" ]]; then
CURL_DATA='{"source_type":"Tag","source_name":"'"$CIRCLE_TAG"'"}';
else
CURL_DATA='{"source_type":"Branch","source_name":"'"$CIRCLE_BRANCH"'"}';
Expand Down
17 changes: 17 additions & 0 deletions .circleci/setartname.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,20 @@ if [[ $CIRCLE_TAG ]]
else
export ARTIFACT_NAME="$(npm run version --silent).circleci-$CIRCLE_BUILD_NUM"
fi

# Determine the channel to push snap to.
SNAP_CHANNEL=edge
RC_VERSION=0.59.0-develop

if [[ "${CIRCLE_TAG+SET}" = "SET" ]]; then
if [[ $CIRCLE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ ]]; then
SNAP_CHANNEL=candidate
RC_VERSION=$CIRCLE_TAG
elif [[ $CIRCLE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
SNAP_CHANNEL=stable
RC_VERSION=$CIRCLE_TAG
fi
fi

export SNAP_CHANNEL
export RC_VERSION
18 changes: 3 additions & 15 deletions .circleci/snap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@ ssh-keyscan -t rsa -H git.launchpad.net > ~/.ssh/known_hosts
git config user.name "CI Bot"
git config user.email "[email protected]"

# Determine the channel to push snap to.
if [[ $CIRCLE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ ]]; then
CHANNEL=candidate
RC_VERSION=$CIRCLE_TAG
elif [[ $CIRCLE_TAG ]]; then
CHANNEL=stable
RC_VERSION=$CIRCLE_TAG
else
CHANNEL=edge
RC_VERSION=0.59.0-develop
fi

echo "Preparing to trigger a snap release for $CHANNEL channel"
echo "Preparing to trigger a snap release for $SNAP_CHANNEL channel"

cd $PWD/.snapcraft

Expand All @@ -34,7 +22,7 @@ chmod 0600 launchpadkey
echo "Tag: $CIRCLE_TAG \r\nBranch: $CIRCLE_BRANCH\r\nBuild: $CIRCLE_BUILD_NUM\r\nCommit: $CIRCLE_SHA1" > buildinfo

# Clone launchpad repo for the channel down.
GIT_SSH_COMMAND="ssh -i launchpadkey" git clone -b $CHANNEL git+ssh://[email protected]/rocket.chat launchpad
GIT_SSH_COMMAND="ssh -i launchpadkey" git clone -b $SNAP_CHANNEL git+ssh://[email protected]/rocket.chat launchpad

# Rarely will change, but just incase we copy it all
cp -r resources buildinfo launchpad/
Expand All @@ -47,7 +35,7 @@ git add resources snapcraft.yaml buildinfo
git commit -m "CircleCI Build: $CIRCLE_BUILD_NUM CircleCI Commit: $CIRCLE_SHA1"

# Push up up to the branch of choice.
GIT_SSH_COMMAND="ssh -i ../launchpadkey" git push origin $CHANNEL
GIT_SSH_COMMAND="ssh -i ../launchpadkey" git push origin $SNAP_CHANNEL

# Clean up
cd ..
Expand Down
16 changes: 2 additions & 14 deletions .circleci/update-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,7 @@
set -euvo pipefail
IFS=$'\n\t'

CHANNEL=develop

if [[ "${CIRCLE_TAG+SET}" = "SET" ]]; then
echo 'if'
if [[ $CIRCLE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+ ]]; then
CHANNEL=candidate
elif [[ $CIRCLE_TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
CHANNEL=stable
fi
fi

if [[ $CHANNEL = "develop" ]]; then
RC_VERSION=0.59.0-develop
if [[ $SNAP_CHANNEL = "develop" ]]; then
aws s3api put-object \
--acl public-read \
--website-redirect-location "https://download.rocket.chat/build/$ARTIFACT_NAME" \
Expand All @@ -26,4 +14,4 @@ aws s3api put-object \
--acl public-read \
--website-redirect-location "https://download.rocket.chat/build/$ARTIFACT_NAME" \
--bucket download.rocket.chat \
--key "$CHANNEL"
--key "$SNAP_CHANNEL"

0 comments on commit 594a33a

Please sign in to comment.