From b6bf83ad72d427b108a7c9a85aab17d4e0bea0ba Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Fri, 23 Aug 2019 21:39:17 -0400 Subject: [PATCH] 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. --- .circleci/config.yml | 8 +++++++- Dockerfile.ci | 31 ------------------------------- GNUmakefile | 7 ------- 3 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 Dockerfile.ci diff --git a/.circleci/config.yml b/.circleci/config.yml index bed7cd65a..0e8e5cd37 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/Dockerfile.ci b/Dockerfile.ci deleted file mode 100644 index a7cb97714..000000000 --- a/Dockerfile.ci +++ /dev/null @@ -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 - diff --git a/GNUmakefile b/GNUmakefile index 7fc7d111d..fb0d3071c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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)'"