From 4c810a27f963fb43becd6afbe13665fdaaad0ac0 Mon Sep 17 00:00:00 2001 From: Riyaz Faizullabhoy Date: Mon, 23 Jan 2017 13:14:19 -0800 Subject: [PATCH] Merge lint.sh into compile.sh, remove unused alpine-build-go Signed-off-by: Riyaz Faizullabhoy --- alpine/base/alpine-build-go/Dockerfile | 8 ------- alpine/base/alpine-build-go/Makefile | 29 -------------------------- alpine/base/alpine-build-go/lint.sh | 16 -------------- alpine/base/binfmt/Makefile | 4 ++-- alpine/base/go-compile/Dockerfile | 2 +- alpine/base/go-compile/Makefile | 4 ++-- alpine/base/go-compile/compile.sh | 12 ++++++++++- alpine/base/go-compile/lint.sh | 14 ------------- alpine/packages/diagnostics/Makefile | 4 ++-- alpine/packages/proxy/Makefile | 4 ++-- alpine/packages/vsudd/Makefile | 4 ++-- docs/hub.md | 2 +- 12 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 alpine/base/alpine-build-go/Dockerfile delete mode 100644 alpine/base/alpine-build-go/Makefile delete mode 100755 alpine/base/alpine-build-go/lint.sh delete mode 100755 alpine/base/go-compile/lint.sh diff --git a/alpine/base/alpine-build-go/Dockerfile b/alpine/base/alpine-build-go/Dockerfile deleted file mode 100644 index 64c46a426..000000000 --- a/alpine/base/alpine-build-go/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM golang:1.7-alpine3.5 -RUN apk update && apk add --no-cache build-base git - -# Get linting tools -RUN go get -u github.com/golang/lint/golint - -# Get the linting script and place in PATH -COPY lint.sh /usr/bin/lint.sh diff --git a/alpine/base/alpine-build-go/Makefile b/alpine/base/alpine-build-go/Makefile deleted file mode 100644 index 547644dec..000000000 --- a/alpine/base/alpine-build-go/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -.PHONY: tag push - -BASE=golang:1.7-alpine3.5 -IMAGE=alpine-build-go - -default: push - -hash: Dockerfile lint.sh - DOCKER_CONTENT_TRUST=1 docker pull $(BASE) - tar cf - $^ | docker build --no-cache -t $(IMAGE):build - - docker run --rm $(IMAGE):build sh -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint | sha1sum' | sed 's/ .*//' > hash - -push: hash - docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ - (docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \ - docker push mobylinux/$(IMAGE):$(shell cat hash)) - docker rmi $(IMAGE):build - rm -f hash - -tag: hash - docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ - docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) - docker rmi $(IMAGE):build - rm -f hash - -clean: - rm -f hash - -.DELETE_ON_ERROR: diff --git a/alpine/base/alpine-build-go/lint.sh b/alpine/base/alpine-build-go/lint.sh deleted file mode 100755 index 669a41496..000000000 --- a/alpine/base/alpine-build-go/lint.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - ->&2 echo "gofmt..." -test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr) - ->&2 echo "govet..." -test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr) - ->&2 echo "golint..." -test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr) - ->&2 echo "Successful lint check!" \ No newline at end of file diff --git a/alpine/base/binfmt/Makefile b/alpine/base/binfmt/Makefile index 5c0571b59..25e9b1b20 100644 --- a/alpine/base/binfmt/Makefile +++ b/alpine/base/binfmt/Makefile @@ -3,8 +3,8 @@ QEMU_IMAGE=mobylinux/qemu-user-static@sha256:6c022f700dc6c263c9107c08aa29b4eae3b QEMU_FILES=qemu-arm qemu-aarch64 qemu-ppc64le QEMU_BINARIES=$(addprefix usr/bin/,$(QEMU_FILES)) -# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f -GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 +# Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c +GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24 BINFMT_BINARY=usr/bin/binfmt # Tag: alpine:3.5 diff --git a/alpine/base/go-compile/Dockerfile b/alpine/base/go-compile/Dockerfile index 02b21d7b8..94204e1b2 100644 --- a/alpine/base/go-compile/Dockerfile +++ b/alpine/base/go-compile/Dockerfile @@ -3,6 +3,6 @@ RUN apk update && apk add --no-cache build-base git RUN go get -u github.com/golang/lint/golint -COPY lint.sh compile.sh /usr/bin/ +COPY compile.sh /usr/bin/ ENTRYPOINT ["/usr/bin/compile.sh"] diff --git a/alpine/base/go-compile/Makefile b/alpine/base/go-compile/Makefile index fd8a5f488..d80093b56 100644 --- a/alpine/base/go-compile/Makefile +++ b/alpine/base/go-compile/Makefile @@ -5,10 +5,10 @@ IMAGE=go-compile default: push -hash: Dockerfile lint.sh compile.sh +hash: Dockerfile compile.sh DOCKER_CONTENT_TRUST=1 docker pull $(BASE) tar cf - $^ | docker build --no-cache -t $(IMAGE):build - - docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /usr/bin/lint.sh /go/bin/golint /usr/bin/compile.sh | sha1sum' | sed 's/ .*//' > hash + docker run --rm --entrypoint=/bin/sh $(IMAGE):build -c 'cat /usr/local/go/bin/go /lib/apk/db/installed /go/bin/golint /usr/bin/compile.sh | sha1sum' | sed 's/ .*//' > hash push: hash docker pull mobylinux/$(IMAGE):$(shell cat hash) || \ diff --git a/alpine/base/go-compile/compile.sh b/alpine/base/go-compile/compile.sh index 4bd3d5c35..6b4c44863 100755 --- a/alpine/base/go-compile/compile.sh +++ b/alpine/base/go-compile/compile.sh @@ -42,7 +42,17 @@ mkdir -p $dir # untar input tar xf - -C $dir -/usr/bin/lint.sh $dir +cd $dir + +# lint before building +>&2 echo "gofmt..." +test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr) + +>&2 echo "govet..." +test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr) + +>&2 echo "golint..." +test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr) >&2 echo "go build..." diff --git a/alpine/base/go-compile/lint.sh b/alpine/base/go-compile/lint.sh deleted file mode 100755 index a1f4618d1..000000000 --- a/alpine/base/go-compile/lint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -set -e - -cd $1 - ->&2 echo "gofmt..." -test -z $(gofmt -s -l .| grep -v .pb. | grep -v */vendor/ | tee /dev/stderr) - ->&2 echo "govet..." -test -z $(go tool vet -printf=false . 2>&1 | grep -v */vendor/ | tee /dev/stderr) - ->&2 echo "golint..." -test -z $(find . -type f -name "*.go" -not -path "*/vendor/*" -not -name "*.pb.*" -exec golint {} \; | tee /dev/stderr) diff --git a/alpine/packages/diagnostics/Makefile b/alpine/packages/diagnostics/Makefile index ac2ee0a4a..2e26aa50c 100644 --- a/alpine/packages/diagnostics/Makefile +++ b/alpine/packages/diagnostics/Makefile @@ -1,5 +1,5 @@ -# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f -GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 +# Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c +GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24 default: usr/bin/diagnostics-server diff --git a/alpine/packages/proxy/Makefile b/alpine/packages/proxy/Makefile index ef302a32f..71ab245f4 100644 --- a/alpine/packages/proxy/Makefile +++ b/alpine/packages/proxy/Makefile @@ -1,5 +1,5 @@ -# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f -GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 +# Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c +GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24 all: usr/bin/slirp-proxy sbin/proxy-vsockd diff --git a/alpine/packages/vsudd/Makefile b/alpine/packages/vsudd/Makefile index 755ed597f..7092f8bc6 100644 --- a/alpine/packages/vsudd/Makefile +++ b/alpine/packages/vsudd/Makefile @@ -1,5 +1,5 @@ -# Tag: bcc7cf6e6fc75e22dacc467043d462e5e9a3dc3f -GO_COMPILE=mobylinux/go-compile@sha256:f0f952162aff1d8962921da101ac18e21d7bb0cb53a3b36a4209a040da5f00e9 +# Tag: 56f72369b2100961d418cd8a614a6019bb53dc9c +GO_COMPILE=mobylinux/go-compile@sha256:98eb2ded03c6bb717b5b19c5723f221b00e85c18352c042d0c8470a4fb32ea24 default: sbin/vsudd diff --git a/docs/hub.md b/docs/hub.md index e2eaf915b..5e32fe0e1 100644 --- a/docs/hub.md +++ b/docs/hub.md @@ -5,10 +5,10 @@ generally with tags based on the image contents. - `mobylinux/alpine-base` the base packages for Moby, before we add Docker and our code and config - `mobylinux/alpine-build-c` for building C code -- `mobylinux/alpine-build-go` for building Go code - `mobylinux/alpine-bios` for building BIOS image - `mobylinux/alpine-efi` for building efi images - `mobylinux/alpine-qemu` for Qemu eg for the tests +- `mobylinux/go-compile` for building Go code The `Dockerfile`s for these are under `alpine/base`. To update, modify the `Dockerfile` if you wish