Attempt to fix jenkins builds (#260)

* Attempt to clean up docker image tags

* Clean only master

* Add back go version and actually use it
This commit is contained in:
Matt Robinson 2018-08-21 22:54:56 -04:00 committed by Philip Hutchins
parent 15657071d7
commit 5841065420
4 changed files with 29 additions and 14 deletions

2
Jenkinsfile vendored
View File

@ -10,9 +10,11 @@ node('node') {
}
stage('Push Images') {
if (env.BRANCH_NAME == "master") {
echo 'Push to Repo'
sh 'make push-images'
}
}
stage('Deploy') {
/* This should only deploy to staging if the branch is master */

View File

@ -1,9 +1,15 @@
.PHONY: test lint proto check-copyrights build-dev-deps
TAG := $$(git rev-parse --short HEAD)
GO_VERSION := 1.10
GO_VERSION ?= 1.10
COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD)
GO_DIRS := $(shell go list ./... | grep -v storj.io/storj/examples)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
ifeq (${BRANCH},master)
TAG := $(shell git rev-parse --short HEAD)-go${GO_VERSION}
else
TAG := $(shell git rev-parse --short HEAD)-${BRANCH}-go${GO_VERSION}
endif
lint: check-copyrights
@ -93,20 +99,26 @@ test-docker-clean:
-docker-compose down --rmi all
images:
docker build --build-arg VERSION=${GO_VERSION} -t storjlabs/satellite:${TAG}-${GO_VERSION} -f cmd/hc/Dockerfile .
docker tag storjlabs/satellite:${TAG}-${GO_VERSION} storjlabs/satellite:latest
docker build -t storjlabs/storage-node:${TAG} -f cmd/farmer/Dockerfile .
docker tag storjlabs/storage-node:${TAG} storjlabs/storage-node:latest
docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/satellite:${TAG} -f cmd/hc/Dockerfile .
docker build --build-arg GO_VERSION=${GO_VERSION} -t storjlabs/storage-node:${TAG} -f cmd/farmer/Dockerfile .
push-images:
docker push storjlabs/satellite:${TAG}-${GO_VERSION}
docker tag storjlabs/satellite:${TAG} storjlabs/satellite:latest
docker push storjlabs/satellite:${TAG}
docker push storjlabs/satellite:latest
docker tag storjlabs/storage-node:${TAG} storjlabs/storage-node:latest
docker push storjlabs/storage-node:${TAG}
docker push storjlabs/storage-node:latest
ifeq (${BRANCH},master)
clean-images:
-docker rmi storjlabs/satellite:${TAG}-${GO_VERSION} storjlabs/satellite:latest
-docker rmi storjlabs/satellite:${TAG} storjlabs/satellite:latest
-docker rmi storjlabs/storage-node:${TAG} storjlabs/storage-node:latest
else
clean-images:
-docker rmi storjlabs/satellite:${TAG}
-docker rmi storjlabs/storage-node:${TAG}
endif
install-deps:
go get -u -v golang.org/x/vgo

View File

@ -1,7 +1,7 @@
# build
FROM golang:1.10-alpine AS build-env
RUN apk add -U curl git musl-dev gcc \
&& apk add git
ARG GO_VERSION=1.10
FROM golang:${GO_VERSION}-alpine AS build-env
RUN apk add -U curl git musl-dev gcc
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
COPY . /go/src/storj.io/storj
RUN cd /go/src/storj.io/storj && dep ensure -vendor-only

View File

@ -1,4 +1,5 @@
FROM golang:1.10-alpine AS build-env
ARG GO_VERSION=1.10
FROM golang:${GO_VERSION}-alpine AS build-env
RUN apk update && \
apk upgrade && \
apk add curl && \