Skip to content

Commit

Permalink
Move to CircleCI 2.0 (#98)
Browse files Browse the repository at this point in the history
* Move to CircleCI 2.0

Use pre-build build container image from build-tools repo - seems too
hard to get all the tools we need into a container running a standard
CircleCI golang image.

Also stop pinning dep since that problem appears to have gone away.
  • Loading branch information
bboreham authored Jun 26, 2018
1 parent 7aef9c3 commit b6bc05f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 71 deletions.
33 changes: 33 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2

# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/
defaults: &defaults
docker:
- image: quay.io/weaveworks/build-golang:1.10.0-stretch
working_directory: /go/src/github.com/weaveworks/common

workflows:
version: 2
test-build-deploy:
jobs:
- lint
- test

jobs:
lint:
<<: *defaults
steps:
- checkout
- run:
name: Lint
command: "make BUILD_IN_CONTAINER=false lint"

test:
<<: *defaults
steps:
- checkout
- run:
name: Test
command: |
dep ensure &&
make BUILD_IN_CONTAINER=false test
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
IMAGE_PREFIX := weaveworks
IMAGE_TAG := $(shell ./tools/image-tag)
UPTODATE := .uptodate
BUILD_IMAGE=quay.io/weaveworks/build-golang:1.10.0-stretch

# Building Docker images is now automated. The convention is every directory
# with a Dockerfile in it builds an image calls quay.io/weaveworks/<dirname>.
Expand All @@ -23,8 +24,6 @@ DOCKER_IMAGE_DIRS=$(patsubst %/Dockerfile,%,$(DOCKERFILES))

all: $(UPTODATE_FILES)

common-build/$(UPTODATE): common-build/*

# All the boiler plate for building golang follows:
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
BUILD_IN_CONTAINER := true
Expand All @@ -41,22 +40,22 @@ NETGO_CHECK = @strings $@ | grep cgo_stub\\\.go >/dev/null || { \

ifeq ($(BUILD_IN_CONTAINER),true)

lint test shell: common-build/$(UPTODATE)
lint test shell:
@mkdir -p $(shell pwd)/.pkg
$(SUDO) docker run $(RM) -ti \
-v $(shell pwd)/.pkg:/go/pkg \
-v $(shell pwd):/go/src/github.com/weaveworks/common \
$(IMAGE_PREFIX)/common-build $@
$(BUILD_IMAGE) $@

else

lint: common-build/$(UPTODATE)
lint:
./tools/lint -notestpackage -ignorespelling queriers -ignorespelling Queriers .

test: common-build/$(UPTODATE)
test:
./tools/test -no-go-get -netgo

shell: common-build/$(UPTODATE)
shell:
bash

endif
Expand Down
32 changes: 0 additions & 32 deletions circle.yml

This file was deleted.

15 changes: 0 additions & 15 deletions common-build/Dockerfile

This file was deleted.

17 changes: 0 additions & 17 deletions common-build/build.sh

This file was deleted.

0 comments on commit b6bc05f

Please sign in to comment.