use circleci/golang images directly

We currently use an container image for `test-devices` job only; while
all other jobs use machine executor.

This allows us to switch golang and protoc verions easily without
manually managing Docker images (which requires building them manually
on a dev machines, etc).  All that while, we install dependencies on
every build in all other jobs..

`test-devices` now is one of the fastest jobs and isn't a constraint or
a bottleneck, so increasing its overhead by few seconds doesn't hurt the
overall developer iteration.

If we split tests effectively later, we can revisit.
This commit is contained in:
Mahmood Ali 2019-08-23 21:39:17 -04:00
parent c832853436
commit e17d7338fc
3 changed files with 7 additions and 39 deletions

View File

@ -70,7 +70,7 @@ executors:
go:
working_directory: /go/src/github.com/hashicorp/nomad
docker:
- image: hashicorpnomad/ci-build-image:20190823_2
- image: circleci/golang:1.12.9
go-machine:
working_directory: ~/go/src/github.com/hashicorp/nomad
machine:
@ -101,6 +101,8 @@ jobs:
GOPATH: /go
steps:
- checkout
- install-protoc
- run: make deps lint-deps
- run: make check
test-container:
@ -119,6 +121,10 @@ jobs:
GOPATH: /go
steps:
- checkout
- run: make deps
- install-protoc
- install-consul
- install-vault
- run-tests
- store_test_results:
path: /tmp/test-reports

View File

@ -1,31 +0,0 @@
FROM circleci/golang:1.12.9
ENV PROTOC_VERSION 3.6.1
ENV VAULT_VERSION 1.1.0
ENV CONSUL_VERSION 1.4.0
RUN sudo apt-get update \
&& sudo apt-get -y upgrade \
&& sudo apt-get install -y unzip \
&& sudo rm -rf /var/lib/apt/lists/*
RUN wget -q -O /tmp/protoc.zip https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
&& unzip /tmp/protoc.zip -d /tmp/protoc3 \
&& sudo mv /tmp/protoc3/bin/* /usr/local/bin/ \
&& sudo mv /tmp/protoc3/include/* /usr/local/include/ \
&& sudo ln -s /usr/local/bin/protoc /usr/bin/protoc \
&& rm -rf /tmp/protoc*
RUN wget -q -O /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip \
&& sudo unzip -d /usr/local/bin /tmp/vault.zip \
&& rm -rf /tmp/vault*
RUN wget -q -O /tmp/consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip \
&& sudo unzip -d /usr/local/bin /tmp/consul.zip \
&& rm -rf /tmp/consul*
## Add the git repo and run bootstrap to install CI dependencies, then remove
## the extra checkout to save image size.
COPY GNUmakefile /tmp/build/GNUmakefile
COPY scripts /tmp/build/scripts
RUN cd /tmp/build && sudo chown -R $(whoami) /tmp/build && make deps lint-deps && rm -rf /tmp/build

View File

@ -380,10 +380,3 @@ ui-screenshots:
ui-screenshots-local:
@echo "==> Collecting UI screenshots (local)..."
@cd scripts/screenshots/src && SCREENSHOTS_DIR="../screenshots" node index.js
.PHONY: ci-image
ci-image: IMAGE_TAG=$(shell date +%Y%m%d)
ci-image:
@echo "==> Building CI Image hashicorpnomad/ci-build-image:$(IMAGE_TAG)"
@docker build . -f Dockerfile.ci -t hashicorpnomad/ci-build-image:$(IMAGE_TAG)
@echo "To push the image, run 'docker push hashicorpnomad/ci-build-image:$(IMAGE_TAG)'"