Skip to content

Instantly share code, notes, and snippets.

@x-cray
Last active December 9, 2015 09:59
Show Gist options
  • Save x-cray/b6df3a9beb5703483876 to your computer and use it in GitHub Desktop.
Save x-cray/b6df3a9beb5703483876 to your computer and use it in GitHub Desktop.
Generates versioned Marathon app definition JSON files
#!/bin/bash
set -e
VERSION="$CI_BRANCH-$CI_COMMIT-$CI_BUILD_NUMBER"
declare -A TARGETS=(
[test-server]="."
)
# Set version in service.json
for i in "${!TARGETS[@]}"
do
SERVICE=${TARGETS[$i]}/service.json
TARGET=service-defs/${TARGETS[$i]}
mkdir -p $TARGET
echo "Setting version $VERSION for $SERVICE"
sed "s/\$tag/$VERSION/g" $SERVICE > $TARGET/service-$CI_BRANCH.json
cp $TARGET/service-$CI_BRANCH.json $TARGET/service-$VERSION.json
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment