build icon indicating copy to clipboard operation
build copied to clipboard

No sample shows me how to build a non trivial Go application

Open dgageot opened this issue 6 years ago • 4 comments

/kind doc

Expected Behavior

As a developer who's going to use Build CRD to build a Go application, I'd like to have a sample that shows me how to write the build.yaml. Go application tend to be touchy about being cloned under GOPATH.

Actual Behavior

I couldn't find any. Nor could I guess how to do that from existing documentation. I mean I did but it's more bash-fu that a proper build descriptor.

apiVersion: build.dev/v1alpha1
kind: Build
metadata:
  name: git-build
spec:
  source:
    git:
      url: https://github.com/GoogleContainerTools/skaffold.git
      branch: master
  steps:
  - image: golang:1.10.2
    args: ["sh", "-c", "mkdir -p /go/src/github.com/GoogleContainerTools && ln -s /workspace /go/src/github.com/GoogleContainerTools/skaffold && make"]
  - image: busybox
    args: ["./out/skaffold", "version"]

dgageot avatar May 28 '18 14:05 dgageot

Indeed there is a lack of documentation for real-world build use cases.

Until such docs exist, you might find it easier to use the go builder we recommend for GCB, which also works in the Build CRD model.

imjasonh avatar May 28 '18 14:05 imjasonh

@ImJasonH Can I choose the version of go with the go builder?

dgageot avatar May 28 '18 15:05 dgageot

No this is currently a limitation of that builder image. It shouldn't be hard to build a matrix of versions if you need that, and I would gladly accept a PR to support that in the cloud-builders repo if you're so inclined. We haven't had many requests for that so far tbh.

imjasonh avatar May 28 '18 15:05 imjasonh

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Send feedback to Knative Productivity Slack channel or knative/test-infra. /lifecycle stale