diff --git a/Dockerfile b/Dockerfile index ca34840b38..e8722e07aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,13 +25,14 @@ ARG COVERALLS_TOKEN ENV COVERALLS_TOKEN $COVERALLS_TOKEN ARG TEST_TARGET +ARG GO_BUILD_TAGS ENV JUNIT_REPORT_DIR $GOPATH/src/github.com/weaveworks/eksctl/test-results/ginkgo RUN mkdir -p "${JUNIT_REPORT_DIR}" WORKDIR $EKSCTL RUN make $TEST_TARGET -RUN make build \ +RUN make build GO_BUILD_TAGS="${GO_BUILD_TAGS}" \ && cp ./eksctl /out/usr/local/bin/eksctl RUN make build-integration-test \ && mkdir -p /out/usr/local/share/eksctl \ diff --git a/Makefile b/Makefile index b2789af1cf..c0ed566ecc 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ version_pkg := github.com/weaveworks/eksctl/pkg/version EKSCTL_BUILD_IMAGE ?= weaveworks/eksctl-build:latest EKSCTL_IMAGE ?= weaveworks/eksctl:latest +GO_BUILD_TAGS ?= netgo + .DEFAULT_GOAL := help ##@ Dependencies @@ -18,7 +20,7 @@ install-build-deps: ## Install dependencies (packages and tools) .PHONY: build build: ## Build eksctl - @CGO_ENABLED=0 go build -tags "netgo" -ldflags "-X $(version_pkg).gitCommit=$(git_commit) -X $(version_pkg).builtAt=$(built_at)" ./cmd/eksctl + CGO_ENABLED=0 go build -tags "$(GO_BUILD_TAGS)" -ldflags "-X $(version_pkg).gitCommit=$(git_commit) -X $(version_pkg).builtAt=$(built_at)" ./cmd/eksctl ##@ Testing & CI @@ -122,7 +124,10 @@ eksctl-build-image: ## Create the the eksctl build docker image @-docker pull $(EKSCTL_BUILD_IMAGE) @docker build --tag=$(EKSCTL_BUILD_IMAGE) --cache-from=$(EKSCTL_BUILD_IMAGE) ./build -EKSCTL_IMAGE_BUILD_ARGS := --build-arg=EKSCTL_BUILD_IMAGE=$(EKSCTL_BUILD_IMAGE) +EKSCTL_IMAGE_BUILD_ARGS := \ + --build-arg=EKSCTL_BUILD_IMAGE=$(EKSCTL_BUILD_IMAGE) \ + --build-arg=GO_BUILD_TAGS=$(GO_BUILD_TAGS) + ifneq ($(COVERALLS_TOKEN),) EKSCTL_IMAGE_BUILD_ARGS += --build-arg=COVERALLS_TOKEN=$(COVERALLS_TOKEN) endif diff --git a/skaffold.yaml b/skaffold.yaml index 8637f220e6..02bb9de8e3 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -5,7 +5,7 @@ profiles: - name: local build: - local: + local: push: false useBuildkit: true tagPolicy: @@ -23,7 +23,7 @@ profiles: - name: push-any-commit build: - local: + local: push: true useBuildkit: true artifacts: @@ -36,9 +36,25 @@ profiles: EKSCTL_BUILD_IMAGE: weaveworks/eksctl-build:local TEST_TARGET: test + - name: push-release + build: + local: + push: true + useBuildkit: true + artifacts: + - image: weaveworks/eksctl-build + context: ./build + - image: weaveworks/eksctl + context: ./ + docker: + buildArgs: + EKSCTL_BUILD_IMAGE: weaveworks/eksctl-build:local + TEST_TARGET: test + GO_BUILD_TAGS: netgo release + - name: local-from-cache build: - local: + local: push: false useBuildkit: true tagPolicy: @@ -59,7 +75,7 @@ profiles: - name: push-cache build: - local: + local: push: true useBuildkit: true tagPolicy: