Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Make sure you can run the tests and build the binary.
```bash
make install-build-deps
make test
make eksctl
make build
```

> NOTE: Windows users should install Docker for Windows and run `make eksctl-image` to build their code.
Expand Down
35 changes: 19 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
built_at := $(shell date +%s)
git_commit := $(shell git describe --dirty --always)

version_pkg := github.com/weaveworks/eksctl/pkg/version

# The dependencies version should be bumped every time the build dependencies are updated
Expand All @@ -10,6 +9,18 @@ EKSCTL_IMAGE ?= weaveworks/eksctl:latest

GOBIN ?= $(shell echo `go env GOPATH`/bin)

AWS_SDK_MOCKS := $(wildcard pkg/eks/mocks/*API.go)

DEEP_COPY_HELPER := pkg/apis/eksctl.io/v1alpha5/zz_generated.deepcopy.go
GENERATED_GO_FILES := pkg/addons/default/assets.go \
pkg/nodebootstrap/assets.go \
$(DEEP_COPY_HELPER) \
pkg/ami/static_resolver_ami.go \
$(AWS_SDK_MOCKS)

GENERATED_GO_FILES := $(GENERATED_FILES) site/content/usage/20-schema.md


.DEFAULT_GOAL := help

##@ Dependencies
Expand All @@ -23,8 +34,9 @@ install-build-deps: ## Install dependencies (packages and tools)
godeps_cmd = go list -deps -f '{{if not .Standard}}{{ $$dep := . }}{{range .GoFiles}}{{$$dep.Dir}}/{{.}} {{end}}{{end}}' $(1) | sed "s%${PWD}/%%g"
godeps = $(shell $(call godeps_cmd,$(1)))

eksctl: $(call godeps,./cmd/...) ## Build main binary
CGO_ENABLED=0 time go build -v -ldflags "-X $(version_pkg).gitCommit=$(git_commit) -X $(version_pkg).builtAt=$(built_at)" ./cmd/eksctl
.PHONY: build
build: $(GENERATED_GO_FILES) ## Build main binary
CGO_ENABLED=0 time go build -ldflags "-X $(version_pkg).gitCommit=$(git_commit) -X $(version_pkg).builtAt=$(built_at)" ./cmd/eksctl

##@ Testing & CI

Expand Down Expand Up @@ -56,7 +68,7 @@ test:
$(MAKE) lint
$(MAKE) check-generated-sources-up-to-date
$(MAKE) unit-test
$(MAKE) eksctl-integration-test
$(MAKE) build-integration-test

.PHONY: unit-test
unit-test: ## Run unit test only
Expand All @@ -66,8 +78,9 @@ unit-test: ## Run unit test only
unit-test-race: ## Run unit test with race detection
CGO_ENABLED=1 time go test -race ./pkg/... ./cmd/... $(UNIT_TEST_ARGS)

eksctl-integration-test: eksctl $(call godeps,`go list -tags integration -f '{{join .XTestImports " "}}' ./integration/...`) ## Build integration test binary
time go test -tags integration ./integration/... -c -o $@
.PHONY: build-integration-test
build-integration-test: $(GENERATED_GO_FILES) ## Build integration test binary
time go test -tags integration ./integration/... -c -o eksctl-integration-test

.PHONY: integration-test
integration-test: eksctl-integration-test ## Run the integration tests (with cluster creation and cleanup)
Expand Down Expand Up @@ -111,16 +124,6 @@ delete-integration-test-dev-cluster: build ## Delete the test cluster for use wh

##@ Code Generation

AWS_SDK_MOCKS := $(wildcard pkg/eks/mocks/*API.go)

DEEP_COPY_HELPER := pkg/apis/eksctl.io/v1alpha5/zz_generated.deepcopy.go
GENERATED_FILES := pkg/addons/default/assets.go \
pkg/nodebootstrap/assets.go \
$(DEEP_COPY_HELPER) \
pkg/ami/static_resolver_ami.go \
site/content/usage/20-schema.md \
$(AWS_SDK_MOCKS)

.PHONY: regenerate-sources
# TODO: generate-ami is broken (see https://github.com/weaveworks/eksctl/issues/949 ), include it when fixed
regenerate-sources: $(GENERATED_FILES) # generate-ami ## Re-generate all the automatically-generated source files
Expand Down
4 changes: 2 additions & 2 deletions eksctl-image-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export JUNIT_REPORT_DIR=/src/test-results/ginkgo
mkdir -p "${JUNIT_REPORT_DIR}"

make $TEST_TARGET
make eksctl \
make build \
&& cp ./eksctl /out/usr/local/bin/eksctl
make eksctl-integration-test \
make build-integration-test \
&& mkdir -p /out/usr/local/share/eksctl \
&& cp integration/*.yaml /out/usr/local/share/eksctl \
&& cp ./eksctl-integration-test /out/usr/local/bin/eksctl-integration-test