Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and cleanup Dockerfiles #261

Merged
merged 1 commit into from
Oct 16, 2018
Merged

Conversation

gruebel
Copy link
Contributor

@gruebel gruebel commented Oct 15, 2018

Description

Updated the build Dockerfile to the newest Golang version 1.11.X, go dep version 0.5.0 and Alpine 3.8.
Updated awscli pip package to version 1.16.33 in the root Dockerfile.

In general removed unneeded steps and changed apk add to use the --no-cache parameter for preventing apk to cache the package index inside the container.

Checklist

  • Code compiles correctly (i.e make build)
  • Added tests that cover your change (if possible)
  • All tests passing (i.e. make test)
  • Added/modified documentation as required (such as the README)
  • Added yourself to the humans.txt file

@errordeveloper errordeveloper self-requested a review October 16, 2018 13:16
errordeveloper
errordeveloper previously approved these changes Oct 16, 2018
@errordeveloper
Copy link
Contributor

@gruebel thanks a lot, this LGTM. I'll try it out locally, and see if I can figure why CircleCI is unhappy.

@errordeveloper
Copy link
Contributor

I was able to reproduce the same error locally with make eksctl-build-image && make eksctl-image.

 ---> 0bea21d888d5
Step 12/20 : RUN make lint && make test && make build     && cp ./eksctl /out/usr/local/bin/eksctl
 ---> Running in 211c5bf916af
Generating mock for: CloudFormationAPI in file: CloudFormationAPI.go
Generating mock for: EKSAPI in file: EKSAPI.go
Generating mock for: EC2API in file: EC2API.go
Generating mock for: STSAPI in file: STSAPI.go
# runtime/cgo
_cgo_export.c:3:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.
FAIL	github.com/weaveworks/eksctl/pkg/ami [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/az [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/cfn/builder [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/cloudconfig [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/eks [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/printers [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/utils/kubeconfig [build failed]
make: *** [Makefile:27: test] Error 2

@errordeveloper
Copy link
Contributor

errordeveloper commented Oct 16, 2018

I'm going to edit makefile locally to debug this, but it seems like breaking this RUN statement would help a lot in the future:

RUN make lint && make test && make build && cp ./eksctl /out/usr/local/bin/eksctl

Right we can only speculate which of the commands produces this error, but we aren't actually concerned with the usage of docker layers here, as the image will get squashed anyway.

diff --git a/Dockerfile b/Dockerfile
index c3236cbc..5eed3b2f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -28,7 +28,9 @@ ARG COVERALLS_TOKEN
 ENV COVERALLS_TOKEN $COVERALLS_TOKEN
 
 WORKDIR $EKSCTL
-RUN make lint && make test && make build \
+RUN make lint
+RUN make test
+RUN make build \
     && cp ./eksctl /out/usr/local/bin/eksctl
 
 RUN go build ./vendor/github.com/kubernetes-sigs/aws-iam-authenticator/cmd/aws-iam-authenticator \

@errordeveloper
Copy link
Contributor

errordeveloper commented Oct 16, 2018

So here is what I've been able to find out:

go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
# runtime/cgo
_cgo_export.c:3:20: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
                    ^
compilation terminated.
FAIL	github.com/weaveworks/eksctl/pkg/ami [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/az [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/cfn/builder [build failed]
=== RUN   TestCFNBuilder
Running Suite: cloud-config Suite
=================================
Random Seed: 1539698804
Will run 5 of 5 specs

•••••
Ran 5 of 5 Specs in 0.002 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestCFNBuilder (0.00s)
PASS
coverage: 70.8% of statements
ok  	github.com/weaveworks/eksctl/pkg/cloudconfig	0.009s	coverage: 70.8% of statements
FAIL	github.com/weaveworks/eksctl/pkg/eks [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/printers [build failed]
FAIL	github.com/weaveworks/eksctl/pkg/utils/kubeconfig [build failed]
make: *** [Makefile:27: test] Error 2
The command '/bin/sh -c make test' returned a non-zero code: 2
make: *** [eksctl-image] Error 2

Here are my local changes:

diff --git a/Dockerfile b/Dockerfile
index c3236cbc..5eed3b2f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -28,7 +28,9 @@ ARG COVERALLS_TOKEN
 ENV COVERALLS_TOKEN $COVERALLS_TOKEN
 
 WORKDIR $EKSCTL
-RUN make lint && make test && make build \
+RUN make lint
+RUN make test
+RUN make build \
     && cp ./eksctl /out/usr/local/bin/eksctl
 
 RUN go build ./vendor/github.com/kubernetes-sigs/aws-iam-authenticator/cmd/aws-iam-authenticator \
diff --git a/Makefile b/Makefile
index e2624db6..03e0dc98 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ build: ## Build eksctl
 test: generate ## Run unit tests
 	@git diff --exit-code pkg/nodebootstrap/assets.go > /dev/null || (git --no-pager diff; exit 1)
 	@git diff --exit-code ./pkg/eks/mocks > /dev/null || (git --no-pager diff; exit 1)
-	@go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
+	go test -v -covermode=count -coverprofile=coverage.out -tags netgo ./pkg/... ./cmd/...
 	@test -z $(COVERALLS_TOKEN) || $(GOPATH)/bin/goveralls -coverprofile=coverage.out -service=circle-ci
 
 LINTER ?= gometalinter ./...

@@ -24,7 +24,7 @@ build: ## Build eksctl
test: generate ## Run unit tests
@git diff --exit-code pkg/nodebootstrap/assets.go > /dev/null || (git --no-pager diff; exit 1)
@git diff --exit-code ./pkg/eks/mocks > /dev/null || (git --no-pager diff; exit 1)
@go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
@CGO_ENABLED=0 go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...

This comment was marked as abuse.

@errordeveloper errordeveloper merged commit 463d56c into eksctl-io:master Oct 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants