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

Cross compile Skaffold, with CGO=1, using xgo #2006

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented Apr 23, 2019

Fixes #1936

Signed-off-by: David Gageot david@gageot.net

@balopat
Copy link
Contributor

balopat commented Apr 29, 2019

retriggered kokoro...

@dgageot dgageot force-pushed the fix-1936 branch 2 times, most recently from e380dc0 to 0795316 Compare May 15, 2019 11:43
@codecov-io
Copy link

codecov-io commented May 15, 2019

Codecov Report

Merging #2006 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2006   +/-   ##
=======================================
  Coverage   58.55%   58.55%           
=======================================
  Files         188      188           
  Lines        7882     7882           
=======================================
  Hits         4615     4615           
  Misses       2877     2877           
  Partials      390      390

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e31530...31e926b. Read the comment docs.

@dgageot dgageot force-pushed the fix-1936 branch 2 times, most recently from de11413 to 023061e Compare May 17, 2019 09:29
Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this in cloudbuild and can't get it to work with either cloudbuild.yaml or cloudbuild_release.yaml. not really sure what's going on but looks like the way the package is specified in the makefile is wrong?

Starting Step #2
Step #2: Already have image: gcr.io/nkubala-demo/skaffold-builder:latest
Step #2: go get github.com/karalabe/xgo
Step #2: mkdir -p ./out
Step #2: xgo -go 1.12 -dest ./out -out skaffold --pkg cmd/skaffold --targets=linux/amd64 -ldflags " -extldflags \"\" -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.version=test -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.buildDate=2019-05-21T20:05:34Z -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitCommit=023061e9263fe2aab321e29cb1bbc00b3583f992 -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitTreeState=dirty " .
Step #2: xgo -go 1.12 -dest ./out -out skaffold --pkg cmd/skaffold --targets=darwin/amd64 -ldflags " -extldflags \"\" -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.version=test -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.buildDate=2019-05-21T20:05:34Z -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitCommit=023061e9263fe2aab321e29cb1bbc00b3583f992 -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitTreeState=dirty " .
Step #2: xgo -go 1.12 -dest ./out -out skaffold --pkg cmd/skaffold --targets=windows/amd64 -ldflags " -extldflags \"\" -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.version=test -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.buildDate=2019-05-21T20:05:34Z -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitCommit=023061e9263fe2aab321e29cb1bbc00b3583f992 -X github.com/GoogleContainerTools/skaffold/pkg/skaffold/version.gitTreeState=dirty " .
Step #2: Checking docker installation...
Step #2: Checking docker installation...
Step #2: Checking docker installation...
Step #2: Client:Client:
Step #2:  Version:	17.12.0-ce
Step #2:  API version:	1.35
Step #2:  Version:	
Step #2:  Go version:	go1.9.2
Step #2:  Git commit:	c97c6d6
Step #2:  Built:	Wed Dec 27 20:11:19 2017
Step #2:  OS/Arch:	17.12.0-celinux/
Step #2:  API version:	amd641.35
Step #2:  Go version:	go1.9.2
Step #2:  Git commit:	
Step #2: 
Step #2: Server:c97c6d6
Step #2:  Built:	 Wed Dec 27 20:11:19 2017
Step #2:  OS/Arch:	Docker Engine - Communitylinux
Step #2:  /Engineamd64:
Step #2:   Version:	18.09.3
Step #2:   API version:	1.39 (minimum version 
Step #2: 
Step #2: Server:1.12)
Step #2:   Go version:	go1.10.8 
Step #2:   Git commit:	Docker Engine - Community774a1f4
Step #2:   Built:	
Step #2:  EngineThu Feb 28 05:59:55 2019
Step #2:   OS/Arch:	:linux
Step #2:   Version:	/18.09.3
Step #2:   API version:	amd64
Step #2:   Experimental:	false
Step #2: 1.39 (minimum version 1.12)
Step #2:   Go version:	go1.10.8
Step #2:   Git commit:	774a1f4
Step #2:   Built:	Thu Feb 28 05:59:55 2019
Step #2:   OS/Arch:	linux/amd64
Step #2:   Experimental:	false
Step #2: Client:
Step #2:  Version:	17.12.0-ce
Step #2:  API version:	1.35
Step #2:  Go version:	go1.9.2
Step #2:  Git commit:	c97c6d6
Step #2:  Built:	Wed Dec 27 20:11:19 2017
Step #2:  OS/Arch:	linux/amd64
Step #2: 
Step #2: Server: Docker Engine - Community
Step #2:  Engine:
Step #2:   Version:	18.09.3
Step #2:   API version:	1.39 (minimum version 1.12)
Step #2:   Go version:	go1.10.8
Step #2:   Git commit:	774a1f4
Step #2:   Built:	Thu Feb 28 05:59:55 2019
Step #2:   OS/Arch:	linux/amd64
Step #2:   Experimental:	false
Step #2: 
Step #2: Checking for required docker image karalabe/xgo-1.12... 
Step #2: Checking for required docker image karalabe/xgo-1.12... 
Step #2: Checking for required docker image karalabe/xgo-1.12... not found!
Step #2: Pulling karalabe/xgo-1.12 from docker registry...
...
Step #2: 71df745edc4b: Pull complete
Step #2: Digest: sha256:8ae9af35741b457f6796914c9e3c215b6cc31109c6c55562042c9e41d97821f5
Step #2: Digest: sha256:8ae9af35741b457f6796914c9e3c215b6cc31109c6c55562042c9e41d97821f5
Step #2: Digest: sha256:8ae9af35741b457f6796914c9e3c215b6cc31109c6c55562042c9e41d97821f5
Step #2: Status: Image is up to date for karalabe/xgo-1.12:latest
Step #2: Status: Downloaded newer image for karalabe/xgo-1.12:latest
Step #2: Status: Image is up to date for karalabe/xgo-1.12:latest
Step #2: Cross compiling ....
Step #2: Cross compiling ....
Step #2: Cross compiling ....
Step #2: Building locally ....
Step #2: Building locally ....
Step #2: Building locally ....
Step #2: Compiling for linux/amd64...
Step #2: Compiling for darwin-10.6/amd64...
Step #2: Compiling for windows-4.0/amd64...
Step #2: can't load package: package ./cmd/skaffold: cannot find package "./cmd/skaffold" in:
Step #2: 	/cmd/skaffold
Step #2: can't load package: package ./cmd/skaffold: cannot find package "./cmd/skaffold" in:
Step #2: 	/cmd/skaffold
Step #2: can't load package: package ./cmd/skaffold: cannot find package "./cmd/skaffold" in:
Step #2: 	/cmd/skaffold
Step #2: 2019/05/21 20:06:43 Failed to cross compile package: exit status 1.
Step #2: Makefile:62: recipe for target 'out/skaffold-darwin-amd64' failed
Step #2: make: *** [out/skaffold-darwin-amd64] Error 1
Step #2: make: *** Waiting for unfinished jobs....
Step #2: 2019/05/21 20:06:43 Failed to cross compile package: exit status 1.
Step #2: Makefile:62: recipe for target 'out/skaffold-linux-amd64' failed
Step #2: make: *** [out/skaffold-linux-amd64] Error 1
Step #2: 2019/05/21 20:06:44 Failed to cross compile package: exit status 1.
Step #2: make: *** [out/skaffold-windows-amd64] Error 1
Step #2: Makefile:62: recipe for target 'out/skaffold-windows-amd64' failed
Finished Step #2
ERROR

@dgageot
Copy link
Contributor Author

dgageot commented May 24, 2019

I have no idea why it works on my machine but not on cloud build... I spent an hour trying to understand. xgo runs containers so on Cloud Build, it's Docker in Docker. Maybe that's the source of the issue. I'll have to try again

@dgageot
Copy link
Contributor Author

dgageot commented May 27, 2019

Turns out it's a docker in docker issue. I'll see if I can find a solution.

@dgageot dgageot force-pushed the fix-1936 branch 3 times, most recently from 4f464a1 to 69a183f Compare May 31, 2019 16:05
@dgageot
Copy link
Contributor Author

dgageot commented May 31, 2019

@nkubala @balopat I might have got it sorted out. Could you please try again?

Fixes GoogleContainerTools#1936

Signed-off-by: David Gageot <david@gageot.net>
Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@balopat
Copy link
Contributor

balopat commented Jun 1, 2019

This is very exciting, thank you for experimenting with it!

@balopat balopat merged commit b139240 into GoogleContainerTools:master Jun 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate the CGO=1 binary release
5 participants