Use a custom builder image
Use a custom builder image to do all of Ark's builds. This image now contains k8s.io/code-generator for code generation. Enable docker in travis to use the builder image. Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>pull/383/head
parent
a5f2fec0a0
commit
1455d67152
|
@ -3,4 +3,9 @@ language: go
|
|||
go:
|
||||
- 1.9.x
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
script: make ci
|
||||
|
|
22
Makefile
22
Makefile
|
@ -55,8 +55,6 @@ endif
|
|||
|
||||
IMAGE := $(REGISTRY)/$(BIN)
|
||||
|
||||
BUILD_IMAGE ?= gcr.io/heptio-images/golang:1.9-alpine3.6
|
||||
|
||||
# If you want to build all binaries, see the 'all-build' rule.
|
||||
# If you want to build all containers, see the 'all-container' rule.
|
||||
# If you want to build AND push all containers, see the 'all-push' rule.
|
||||
|
@ -92,20 +90,21 @@ _output/bin/$(GOOS)/$(GOARCH)/$(BIN): build-dirs
|
|||
|
||||
TTY := $(shell tty -s && echo "-t")
|
||||
|
||||
BUILDER_IMAGE := ark-builder
|
||||
|
||||
# Example: make shell CMD="date > datefile"
|
||||
shell: build-dirs
|
||||
shell: build-dirs build-image
|
||||
@docker run \
|
||||
-i $(TTY) \
|
||||
--rm \
|
||||
-u $$(id -u):$$(id -g) \
|
||||
-v "$$(pwd)/.go/pkg:/go/pkg" \
|
||||
-v "$$(pwd)/.go/src:/go/src" \
|
||||
-v "$$(pwd)/.go/std:/go/std" \
|
||||
-v "$$(pwd):/go/src/$(PKG)" \
|
||||
-v "$$(pwd)/_output/bin:/output" \
|
||||
-v "$$(pwd)/.go/std/$(GOOS)/$(GOARCH):/usr/local/go/pkg/$(GOOS)_$(GOARCH)_static" \
|
||||
-w /go/src/$(PKG) \
|
||||
$(BUILD_IMAGE) \
|
||||
$(BUILDER_IMAGE) \
|
||||
/bin/sh $(CMD)
|
||||
|
||||
DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION))
|
||||
|
@ -173,15 +172,12 @@ build-dirs:
|
|||
@mkdir -p _output/bin/$(GOOS)/$(GOARCH)
|
||||
@mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(GOOS)/$(GOARCH)
|
||||
|
||||
clean: container-clean bin-clean
|
||||
build-image:
|
||||
cd hack/build-image && docker build -t $(BUILDER_IMAGE) .
|
||||
|
||||
container-clean:
|
||||
clean:
|
||||
rm -rf .container-* _output/.dockerfile-* .push-*
|
||||
|
||||
bin-clean:
|
||||
rm -rf .go _output
|
||||
docker rmi $(BUILDER_IMAGE)
|
||||
|
||||
ci:
|
||||
hack/verify-all.sh
|
||||
hack/test.sh $(SRC_DIRS)
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) VERSION=$(VERSION) PKG=$(PKG) BIN=$(BIN) ./hack/build.sh
|
||||
ci: build verify test
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# Copyright 2018 the Heptio Ark contributors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM gcr.io/heptio-images/golang:1.9-alpine3.6
|
||||
|
||||
RUN mkdir -p /go/src/k8s.io && \
|
||||
cd /go/src/k8s.io && \
|
||||
git clone -b kubernetes-1.9.0 https://github.com/kubernetes/code-generator && \
|
||||
git clone -b kubernetes-1.9.0 https://github.com/kubernetes/apimachinery && \
|
||||
echo chmod -R a+w /go
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2017 the Heptio Ark contributors.
|
||||
#
|
||||
|
@ -14,13 +14,26 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
HACK_DIR=$(dirname "${BASH_SOURCE}")
|
||||
REPO_ROOT=${HACK_DIR}/..
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
set -o xtrace
|
||||
|
||||
${REPO_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \
|
||||
if [[ -z "${GOPATH}" ]]; then
|
||||
GOPATH=~/go
|
||||
fi
|
||||
|
||||
if [[ ! -d "${GOPATH}/src/k8s.io/code-generator" ]]; then
|
||||
echo "k8s.io/code-generator missing from GOPATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ${GOPATH}/src/k8s.io/code-generator
|
||||
|
||||
./generate-groups.sh \
|
||||
all \
|
||||
github.com/heptio/ark/pkg/generated \
|
||||
github.com/heptio/ark/pkg/apis \
|
||||
ark:v1 \
|
||||
--go-header-file hack/boilerplate.go.txt \
|
||||
--go-header-file ${GOPATH}/src/github.com/heptio/ark/hack/boilerplate.go.txt \
|
||||
$@
|
||||
|
|
Loading…
Reference in New Issue