Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
refactor packaging scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
woodsaj committed Jul 15, 2016
1 parent 153079e commit 6478a91
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 176 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
default:
$(MAKE) all
test:
bash -c "./scripts/test.sh $(TEST)"
check:
$(MAKE) test
all:
bash -c "./scripts/build.sh"
9 changes: 0 additions & 9 deletions build.sh

This file was deleted.

14 changes: 0 additions & 14 deletions pkg/build.sh

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/config/ubuntu/trusty/etc/init/nsq_metrics_to_elasticsearch

This file was deleted.

This file was deleted.

48 changes: 0 additions & 48 deletions pkg/depends.sh

This file was deleted.

45 changes: 0 additions & 45 deletions pkg/package.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -x
# Find the directory we exist within
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

GITVERSION=`git describe --always`
SOURCEDIR=${DIR}/..
BUILDDIR=$SOURCEDIR/build

# Make dir
mkdir -p $BUILDDIR

# Clean build bin dir
rm -rf $BUILDDIR/*

# Build binary
cd ../
go build -ldflags "-X main.GitHash=$GITVERSION" -o $BUILDDIR/metric-tank
26 changes: 26 additions & 0 deletions scripts/depends.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -x
# Find the directory we exist within
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

: ${GOPATH:="${HOME}/.go_workspace"}
: ${ORG_PATH:="github.com/raintank"}
: ${REPO_PATH:="${ORG_PATH}/metrictank"}

if [ ! -z ${CIRCLECI} ] ; then
: ${CHECKOUT:="/home/ubuntu/${CIRCLE_PROJECT_REPONAME}"}
else
: ${CHECKOUT:="${DIR}/.."}
fi

export GOPATH

bundle install

echo "Linking ${GOPATH}/src/${REPO_PATH} to ${CHECKOUT}"
mkdir -p ${GOPATH}/src/${ORG_PATH}
ln -s ${CHECKOUT} ${GOPATH}/src/${REPO_PATH}

cd ${GOPATH}/src/${REPO_PATH}
go get -t ./...
8 changes: 4 additions & 4 deletions pkg/deploy.sh → scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

set -x
# Find the directory we exist within
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

ls -l ${DIR}/../build/*.deb
if [ -z ${PACKAGECLOUD_REPO} ] ; then
echo "The environment variable PACKAGECLOUD_REPO must be set."
exit 1
fi

package_cloud push ${PACKAGECLOUD_REPO}/ubuntu/trusty ${DIR}/artifacts/*.deb
git push --tags
# Only do the ubuntu pkg for now.
package_cloud push ${PACKAGECLOUD_REPO}/ubuntu/trusty ${DIR}/../build/*.deb
24 changes: 24 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -x
BASE=$(dirname $0)
CODE_DIR=$(readlink -e "$BASE/../")

BUILD=$CODE_DIR/build

ARCH="$(uname -m)"
VERSION=$(git describe --long --always)

PACKAGE_NAME="${BUILD}/metric_tank-${VERSION}_${ARCH}.deb"
mkdir -p ${BUILD}/usr/sbin
mkdir -p ${BUILD}/etc/init
mkdir -p ${BUILD}/etc/raintank

cp ${BASE}/config/ubuntu/trusty/etc/raintank/metric_tank.ini ${BUILD}/etc/raintank/
cp ${BASE}/etc/init/raintank-probe.conf ${BUILD}/etc/init
mv ${BUILD}/raintank-probe ${BUILD}/usr/bin/

fpm -s dir -t deb \
-v ${VERSION} -n raintank-probe -a ${ARCH} --description "metrictank, the gorilla-inspired timeseries database backend for graphite" \
--deb-upstart ${BASE}/config/ubuntu/trusty/etc/init/metric_tank \
-C ${BUILD} -p ${PACKAGE_NAME} .

0 comments on commit 6478a91

Please sign in to comment.