Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Sort out docker and release builds
Browse files Browse the repository at this point in the history
Signed-off-by: Silas Davis <[email protected]>
  • Loading branch information
Silas Davis committed Aug 20, 2018
1 parent f204ba0 commit 4aafe69
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 49 deletions.
45 changes: 10 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,16 @@ jobs:
<<: *setup_docker
# build docker image and tag the docker image(s) depending on branch/tag
- run: make docker_build
- run: docker save $DOCKER_REPO > db-images.tar
- persist_to_workspace:
root: .
paths:
- .

# Simple smoke test to ensure burrow binary has been provisioned to container
test_docker_smoke:
<<: *defaults
steps:
- attach_workspace:
at: .
- setup_remote_docker:
<<: *setup_docker
- run: docker load -i db-images.tar
- run: docker run $DOCKER_REPO:$(./scripts/local_version.sh) -h

push_docker:
push_docker_dev:
<<: *defaults
steps:
- attach_workspace:
at: .
- setup_remote_docker:
<<: *setup_docker
# Only run on non-pull requests
- run: "[[ -n \"$CIRCLE_PULL_REQUESTS\" ]] || (docker login -u $DOCKER_USER -p $DOCKER_PASS && docker load -i db-images.tar && docker push $DOCKER_REPO)"
- run: "[[ -n \"$CIRCLE_PULL_REQUESTS\" ]] || (docker login -u $DOCKER_USER_DEV -p $DOCKER_PASS_DEV && docker push $DOCKER_REPO_DEV)"

release:
<<: *defaults
Expand Down Expand Up @@ -114,35 +98,26 @@ workflows:
<<: *tags_filters

- build_docker:
filters:
<<: *tags_filters

- test_docker_smoke:
requires:
- build_docker
filters:
<<: *tags_filters

- push_docker:
requires:
- test
- test_integration
- test_integration_bosmarmot
- 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
# releases on master that we specifically want to build)
<<: *tags_filters

- push_docker_dev:
requires:
- test
- test_integration
- test_integration_bosmarmot
filters:
branches:
ignore: /.*/
only: develop

- release:
requires:
- test
- test_integration
- test_integration_bosmarmot
- test_docker_smoke
filters:
<<: *tags_filters
branches:
Expand Down
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ CHANGELOG.md
README.md
.circleci
docs
bin
bin
scripts
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ FROM alpine:3.8

ARG REPO=/go/src/github.com/hyperledger/burrow

ENV USER monax
ENV MONAX_PATH /home/$USER/.monax
ENV USER burrow
ENV BURROW_PATH /home/$USER
RUN addgroup -g 101 -S $USER && adduser -S -D -u 1000 $USER $USER
WORKDIR $MONAX_PATH
WORKDIR $ BURROW_PATH
USER $USER:$USER

# Copy binaries built in previous stage
COPY --from=builder $REPO/bin/* /usr/local/bin/
#RUN chown $USER:$USER /usr/local/bin/burrow*

# Expose ports for 26656:tendermint-peer; 26658: tm; 10997 GRPC
# Expose ports for 26656: tendermint-peer; 26658: info; 10997: GRPC
EXPOSE 26656
EXPOSE 26658
EXPOSE 10997
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,21 @@ commit_hash:

# build all targets in github.com/hyperledger/burrow
.PHONY: build
build: check build_db
build: check build_burrow

# build all targets in github.com/hyperledger/burrow with checks for race conditions
.PHONY: build_race
build_race: check build_race_db

# build burrow
.PHONY: build_db
build_db: commit_hash
.PHONY: build_burrow
build_burrow: commit_hash
go build -ldflags "-extldflags '-static' \
-X github.com/hyperledger/burrow/project.commit=$(shell cat commit_hash.txt)" \
-o ${REPO}/bin/burrow ./cmd/burrow

.PHONY: install_db
install_db: build_db
.PHONY: install_burrow
install_burrow: build_burrow
cp ${REPO}/bin/burrow ${GOPATH}/bin/burrow

# build burrow with checks for race conditions
Expand Down Expand Up @@ -168,7 +168,7 @@ test: check bin/solc
@tests/scripts/bin_wrapper.sh go test ./... ${GOPACKAGES_NOVENDOR}

.PHONY: test_keys
test_keys: build_db
test_keys: build_burrow
burrow_bin="${REPO}/bin/burrow" keys/test.sh

rpc/test/strange_loop.go: integration/rpctest
Expand All @@ -186,7 +186,7 @@ test_deploy: bin/solc
# Run integration test from bosmarmot (separated from other integration tests so we can
# make exception when this test fails when we make a breaking change in Burrow)
.PHONY: test_integration_bosmarmot
test_integration_bosmarmot: bos build_db
test_integration_bosmarmot: bos build_burrow
cd "${BOSMARMOT_CHECKOUT}" &&\
make npm_install && \
GOPATH="${BOSMARMOT_GOPATH}" \
Expand Down Expand Up @@ -235,7 +235,7 @@ tag_release: test check CHANGELOG.md NOTES.md build
@scripts/tag_release.sh

.PHONY: release
release: docs check test
release: docs check test docker_build
@scripts/is_checkout_dirty.sh || (echo "checkout is dirty so not releasing!" && exit 1)
@scripts/release.sh

Expand Down
3 changes: 3 additions & 0 deletions scripts/build_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ if [[ "$1" ]] ; then
fi

docker build -t ${DOCKER_REPO}:${version} ${REPO}
# Quick smoke test
echo "Emitting version from docker image as smoke test..."
docker run ${DOCKER_REPO}:${version} -v

6 changes: 5 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

version_regex="^v[0-9]+\.[0-9]+\.[0-9]+$"

set -e

function release {
notes="NOTES.md"
echo "Building and releasing $tag..."
echo "Pushing docker image..."
docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && docker push ${DOCKER_REPO}
echo "Building and pushing binaries"
[[ -e "$notes" ]] && goreleaser --release-notes "$notes" || goreleaser
}

Expand All @@ -30,4 +34,4 @@ if [[ ! ${tag} =~ ${version_regex} ]] ; then
exit 0
fi

release
release

0 comments on commit 4aafe69

Please sign in to comment.