Skip to content

Commit

Permalink
Merge pull request #8 from weaveworks/7-gzip
Browse files Browse the repository at this point in the history
Compress cached images.
  • Loading branch information
paulbellamy committed Nov 4, 2015
2 parents f250a3b + 4be5541 commit 452f2b7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions cover/gather_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# This scripts copies all the coverage reports from various circle shards,
# merges them and produces a complete report.

set -ex
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DESTINATION=$1
FROMDIR=$2
mkdir -p $DESTINATION

if [ -n "$CIRCLECI" ]; then
for i in $(seq 1 $(($CIRCLE_NODE_TOTAL - 1))); do
scp node$i:$FROMDIR/* $DESTINATION || true
done
fi

go get github.com/weaveworks/build-tools/cover
cover $DESTINATION/* >profile.cov
go tool cover -html=profile.cov -o coverage.html
go tool cover -func=profile.cov -o coverage.txt
tar czf coverage.tar.gz $DESTINATION
6 changes: 3 additions & 3 deletions rebuild-image
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ rebuild() {
mkdir -p $CACHEDIR
rm $CACHEDIR/$SAVEDNAME* || true
docker build -t $IMAGENAME $IMAGEDIR
docker save $IMAGENAME:latest > $CACHEDIR/$SAVEDNAME-$CIRCLE_SHA1
docker save $IMAGENAME:latest | gzip - > $CACHEDIR/$SAVEDNAME-$CIRCLE_SHA1.gz
}

# Get the revision the cached image was build at
cached_image_rev() {
find $CACHEDIR -name "$SAVEDNAME-*" -type f | sed 's/[^\-]*\-//'
find $CACHEDIR -name "$SAVEDNAME-*" -type f | sed -n 's/^[^\-]*\-\([a-z0-9]*\).gz$/\1/p'
}

# Have there been any revision beween $1 and $2
Expand Down Expand Up @@ -60,4 +60,4 @@ fi

# we didn't rebuild; import cached version
echo ">>> No changes found, importing cached image"
docker load -i $CACHEDIR/$SAVEDNAME-$cached_revision
zcat $CACHEDIR/$SAVEDNAME-$cached_revision.gz | docker load

0 comments on commit 452f2b7

Please sign in to comment.