Skip to content
Snippets Groups Projects
Commit 59402cc9 authored by Casey Kuhlman's avatar Casey Kuhlman Committed by GitHub
Browse files

Merge pull request #652 from silasdavis/ci-smoke-test

Make sure we check for presence of burrow binary and that build succeeds
parents 4db705ee 3b08a83e
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,10 @@ tag_filters: &tags_filters
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
setup_docker: &setup_docker
version: 17.06.1-ce
# Start of CircleCI 2.0 config
version: 2
jobs:
checkout_code:
......@@ -38,25 +42,44 @@ jobs:
at: .
- run: make test_integration
build:
build_docker:
<<: *defaults
steps:
- attach_workspace:
at: .
- run: make build
# This allows us to perform our docker builds
- setup_remote_docker:
<<: *setup_docker
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
# build docker image and tag the docker image(s) depending on branch/tag
- run: make build_docker_db
- run: docker save quay.io/monax/db > db-images.tar
- persist_to_workspace:
root: .
paths:
- db-images.tar
release:
# Simple smoke test to ensure burrow binary has been provisioned to container
test_docker_smoke:
<<: *defaults
steps:
# restore checkout
- attach_workspace:
at: .
# This allows us to perform our docker builds
- setup_remote_docker:
version: 17.06.1-ce
<<: *setup_docker
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
# build docker image and tag the image with the version, date, and commit hash
- run: make build_docker_db
- run: docker load -i db-images.tar
- run: docker run quay.io/monax/db:$(./scripts/local_version.sh) burrow -h
push_docker:
<<: *defaults
steps:
- attach_workspace:
at: .
- setup_remote_docker:
<<: *setup_docker
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
- run: docker load -i db-images.tar
- run: docker push quay.io/monax/db
......@@ -72,6 +95,7 @@ workflows:
# In contract jobs build against all branches by default
filters:
<<: *tags_filters
- test:
requires:
- checkout_code
......@@ -84,17 +108,23 @@ workflows:
filters:
<<: *tags_filters
- build:
- build_docker:
requires:
- checkout_code
filters:
<<: *tags_filters
- release:
- test_docker_smoke:
requires:
- build_docker
filters:
<<: *tags_filters
- push_docker:
requires:
- test
- test_integration
- build
- test_docker_smoke
filters:
# tags filters and branch filters are applied disjunctively, so we
# will still build tags not on develop (i.e. including tagged
......
......@@ -17,6 +17,8 @@ RUN go build --ldflags '-extldflags "-static"' -o bin/burrow-client ./client/cmd
# This will be our base container image
FROM alpine:3.6
ARG REPO=/go/src/github.com/hyperledger/burrow
ENV USER monax
ENV MONAX_PATH /home/$USER/.monax
RUN addgroup -g 101 -S $USER && adduser -S -D -u 1000 $USER $USER
......
......@@ -138,7 +138,7 @@ test_race: build_race
# build docker image for burrow
.PHONY: build_docker_db
build_docker_db: check
@./build_tool.sh
@scripts/build_tool.sh
### Clean up
......
......@@ -21,31 +21,19 @@
set -e
IMAGE=${IMAGE:-"quay.io/monax/db"}
VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
version=$(go run ./util/version/cmd/main.go)
tag=$(git tag --points-at HEAD)
if [[ ${tag} =~ ${VERSION_REGEX} ]] ; then
# Only label a build as a release version when the commit is tagged
echo "Building release version (tagged $tag)..."
# Fail noisily when trying to build a release version that does not match code tag
if [[ ! ${tag} = "v$version" ]]; then
echo "Build failure: version tag $tag does not match version/version.go version $version"
exit 1
fi
else
date=$(date +"%Y%m%d")
commit=$(git rev-parse --short HEAD)
version="$version-dev-$date-$commit"
echo "Building non-release version $version..."
fi
REPO=${REPO:-"$GOPATH/src/github.com/hyperledger/burrow"}
function log() {
echo "$*" >> /dev/stderr
}
version=$("$REPO/scripts/local_version.sh")
if [[ "$1" ]] ; then
# If argument provided, use it as the version tag
echo "Overriding detected version $version and tagging image as $1"
log "Overriding detected version $version and tagging image as $1"
version="$1"
fi
docker build -t ${IMAGE}:${version} .
docker build -t ${IMAGE}:${version} ${REPO}
#!/usr/bin/env bash
#
# Script that outputs a version identifier based on the in-code version of
# Burrow combined with date and git commit or the git tag if tag is a version.
#
# If working directory is checked out at a version tag then checks that the tag
# matches the in-code version and fails if it does not.
#
set -e
REPO=${REPO:-"$GOPATH/src/github.com/hyperledger/burrow"}
VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
version=$(go run "$REPO/util/version/cmd/main.go")
tag=$(git tag --points-at HEAD)
function log() {
echo "$*" >> /dev/stderr
}
if [[ ${tag} =~ ${VERSION_REGEX} ]] ; then
# Only label a build as a release version when the commit is tagged
log "Building release version (tagged $tag)..."
# Fail noisily when trying to build a release version that does not match code tag
if [[ ! ${tag} = "v$version" ]]; then
log "Build failure: version tag $tag does not match version/version.go version $version"
exit 1
fi
else
date=$(date +"%Y%m%d")
commit=$(git rev-parse --short HEAD)
version="$version-dev-$date-$commit"
log "Building non-release version $version..."
fi
echo ${version}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment