diff --git a/.circleci/config.yml b/.circleci/config.yml index a955336be..8e588a7f6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,24 +58,8 @@ 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: @@ -83,7 +67,7 @@ jobs: - 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 @@ -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: diff --git a/.dockerignore b/.dockerignore index a29b1c4a1..8342b8f14 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,4 +10,5 @@ CHANGELOG.md README.md .circleci docs -bin \ No newline at end of file +bin +scripts \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0749a7a0c..bea20404e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/Makefile b/Makefile index 9a8a744cb..60c4db3e9 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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}" \ @@ -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 diff --git a/scripts/build_tool.sh b/scripts/build_tool.sh index 006e5b294..1f1d0aa57 100755 --- a/scripts/build_tool.sh +++ b/scripts/build_tool.sh @@ -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 diff --git a/scripts/release.sh b/scripts/release.sh index d54a1f00d..fda4ec696 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -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 } @@ -30,4 +34,4 @@ if [[ ! ${tag} =~ ${version_regex} ]] ; then exit 0 fi -release +release \ No newline at end of file