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

Attempt to clarify use of Golang image, Modules and Mirror #517

Merged
merged 2 commits into from Jul 10, 2019

Conversation

@DazWilkin
Copy link
Contributor

commented Jul 10, 2019

@ImJasonH -- as discussed via email, a proposal to:

  • Increase clarity around use of the non-Builder, regular Golang image
  • Explained Golang image's use of /go and Cloud Build's use of /workspace
  • Added description for sharing packages across steps
  • Added description for using GOPROXY=https://proxy.golang.org
  • Referenced mirror.gcr.io/library/golang -- will file a separate bug about the Golang version omission
@googlebot googlebot added the cla: yes label Jul 10, 2019
Copy link
Member

left a comment

Thanks for adding this! Just a few small comments. It'd be great to have an example in the directory's cloudbuild.yaml demonstrating it functionally, but if you don't feel like adding it in this PR then I can take a crack at it in a followup.

@@ -4,27 +4,70 @@ This builder runs the `go` tool (`go build`, `go test`, etc.)
after placing source in `/workspace` into the `GOPATH` before
running the tool.

This functionality is not necessary if you're building using
# Using `Golang` and [Go Modules](https://github.com/golang/go/wiki/Modules)

This comment has been minimized.

Copy link
@ImJasonH

ImJasonH Jul 10, 2019

Member

Docker image names must be lowercase, so I'd prefer to refer to it as golang

This comment has been minimized.

Copy link
@DazWilkin

DazWilkin Jul 10, 2019

Author Contributor

Fixed: f7fbd8a

in Go 1.11+, and you can **build with the standard
[`golang`](https://hub.docker.com/_/golang) image on Dockerhub
instead:**
in Go 1.11+. You can **build** with the `golang` image (not a Builder) from [Dockerhub](hub.docker.com/library/golang) and Google's Container Registry [mirror](mirror.gcr.io/library/golang):

This comment has been minimized.

Copy link
@ImJasonH

ImJasonH Jul 10, 2019

Member

"(not a Builder)" is a bit misleading; any image can be used as a "builder" -- the term is fairly ill-defined -- including the golang image.

This comment has been minimized.

Copy link
@DazWilkin

DazWilkin Jul 10, 2019

Author Contributor

Fixed: f7fbd8a

in Go 1.11+, and you can **build with the standard
[`golang`](https://hub.docker.com/_/golang) image on Dockerhub
instead:**
in Go 1.11+. You can **build** with the `golang` image (not a Builder) from [Dockerhub](hub.docker.com/library/golang) and Google's Container Registry [mirror](mirror.gcr.io/library/golang):

This comment has been minimized.

Copy link
@ImJasonH

ImJasonH Jul 10, 2019

Member

We configure GCB to use the GCR mirror by default, so there's no need to explicitly request the mirrored version. Just referencing golang will pull through the GCR mirror if available, and not if not.

This comment has been minimized.

Copy link
@DazWilkin

DazWilkin Jul 10, 2019

Author Contributor

Interesting. How does this square with: https://issuetracker.google.com/issues/137170318

This comment has been minimized.

Copy link
@ImJasonH

ImJasonH Jul 10, 2019

Member

That I don't know, I'd have to talk to the GCR team to understand more.

In general I think we should not ask users to request from mirror.gcr.io directly, but instead just configure their Docker installation to use the mirror, or in the case of GCB, just rely on it already configuring that.

env:
- GO111MODULE=on
args: ['go','get','-u','github.com/golang/glog']
volumes:

This comment has been minimized.

Copy link
@ImJasonH

ImJasonH Jul 10, 2019

Member

You can now specify build-wide volumes and envs using .options.env and .options.volumes, to avoid having to repeat yourself.

This comment has been minimized.

Copy link
@DazWilkin

DazWilkin Jul 10, 2019

Author Contributor

IDNKT. Will reflect.

This comment has been minimized.

Copy link
@DazWilkin

DazWilkin Jul 10, 2019

Author Contributor

See f7fbd8a

@ImJasonH ImJasonH merged commit 4e892bd into GoogleCloudPlatform:master Jul 10, 2019
1 check passed
1 check passed
cla/google All necessary CLAs are signed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.