|
1 | 1 | apiVersion: tekton.dev/v1 |
2 | 2 | kind: Task |
3 | 3 | metadata: |
4 | | - name: golang-build |
5 | | - labels: |
6 | | - app.kubernetes.io/version: "1.0.0" |
7 | 4 | annotations: |
8 | | - tekton.dev/pipelines.minVersion: "0.12.1" |
9 | | - tekton.dev/categories: Build Tools |
10 | | - tekton.dev/tags: build-tool |
11 | | - tekton.dev/displayName: "golang build" |
12 | | - tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le" |
13 | 5 | tekton.dev/catalog: tektoncd.golang |
14 | 6 | tekton.dev/catalog-support-tier: verified |
15 | 7 | tekton.dev/catalog-url: https://github.com/tektoncd-catalog/golang |
| 8 | + tekton.dev/categories: Build Tools |
| 9 | + tekton.dev/displayName: golang build |
| 10 | + tekton.dev/pipelines.minVersion: 0.12.1 |
| 11 | + tekton.dev/platforms: linux/amd64,linux/s390x,linux/ppc64le |
| 12 | + tekton.dev/signature: MEYCIQD3SUEwqc1qbXXln+XMWd61fi5ks21FD3dEV37n/j2pzQIhAKfVG0ciLqbObDKdo5T/Y3urJ4x41v2eb3QeNIz0lCCq |
| 13 | + tekton.dev/tags: build-tool |
| 14 | + creationTimestamp: null |
| 15 | + labels: |
| 16 | + app.kubernetes.io/version: 1.0.0 |
| 17 | + name: golang-build |
16 | 18 | spec: |
17 | | - description: >- |
18 | | - This Task is Golang task to build Go projects. |
19 | | -
|
| 19 | + description: This Task is Golang task to build Go projects. |
20 | 20 | params: |
21 | | - - name: package |
22 | | - description: base package to build in |
23 | | - - name: packages |
24 | | - description: "packages to build (default: ./cmd/...)" |
25 | | - default: "./cmd/..." |
26 | | - - name: version |
| 21 | + - description: base package to build in |
| 22 | + name: package |
| 23 | + - default: ./cmd/... |
| 24 | + description: 'packages to build (default: ./cmd/...)' |
| 25 | + name: packages |
| 26 | + - default: latest |
27 | 27 | description: golang version to use for builds |
28 | | - default: "latest" |
29 | | - - name: flags |
| 28 | + name: version |
| 29 | + - default: -v |
30 | 30 | description: flags to use for the test command |
31 | | - default: -v |
32 | | - - name: GOOS |
33 | | - description: "running program's operating system target" |
34 | | - default: linux |
35 | | - - name: GOARCH |
36 | | - description: "running program's architecture target" |
37 | | - default: amd64 |
38 | | - - name: GO111MODULE |
39 | | - description: "value of module support" |
40 | | - default: auto |
41 | | - - name: GOCACHE |
42 | | - description: "Go caching directory path" |
43 | | - default: "" |
44 | | - - name: GOMODCACHE |
45 | | - description: "Go mod caching directory path" |
46 | | - default: "" |
47 | | - - name: CGO_ENABLED |
48 | | - description: "Toggle cgo tool during Go build. Use value '0' to disable cgo (for static builds)." |
49 | | - default: "" |
50 | | - - name: GOSUMDB |
51 | | - description: "Go checksum database url. Use value 'off' to disable checksum validation." |
52 | | - default: "" |
53 | | - workspaces: |
54 | | - - name: source |
| 31 | + name: flags |
| 32 | + - default: linux |
| 33 | + description: running program's operating system target |
| 34 | + name: GOOS |
| 35 | + - default: amd64 |
| 36 | + description: running program's architecture target |
| 37 | + name: GOARCH |
| 38 | + - default: auto |
| 39 | + description: value of module support |
| 40 | + name: GO111MODULE |
| 41 | + - default: "" |
| 42 | + description: Go caching directory path |
| 43 | + name: GOCACHE |
| 44 | + - default: "" |
| 45 | + description: Go mod caching directory path |
| 46 | + name: GOMODCACHE |
| 47 | + - default: "" |
| 48 | + description: Toggle cgo tool during Go build. Use value '0' to disable cgo (for |
| 49 | + static builds). |
| 50 | + name: CGO_ENABLED |
| 51 | + - default: "" |
| 52 | + description: Go checksum database url. Use value 'off' to disable checksum validation. |
| 53 | + name: GOSUMDB |
55 | 54 | steps: |
56 | | - - name: build |
| 55 | + - env: |
| 56 | + - name: GOOS |
| 57 | + value: $(params.GOOS) |
| 58 | + - name: GOARCH |
| 59 | + value: $(params.GOARCH) |
| 60 | + - name: GO111MODULE |
| 61 | + value: $(params.GO111MODULE) |
| 62 | + - name: GOCACHE |
| 63 | + value: $(params.GOCACHE) |
| 64 | + - name: GOMODCACHE |
| 65 | + value: $(params.GOMODCACHE) |
| 66 | + - name: CGO_ENABLED |
| 67 | + value: $(params.CGO_ENABLED) |
| 68 | + - name: GOSUMDB |
| 69 | + value: $(params.GOSUMDB) |
57 | 70 | image: docker.io/library/golang:$(params.version) |
58 | | - workingDir: $(workspaces.source.path) |
| 71 | + name: build |
| 72 | + resources: {} |
59 | 73 | script: | |
60 | 74 | if [ ! -e $GOPATH/src/$(params.package)/go.mod ];then |
61 | 75 | SRC_PATH="$GOPATH/src/$(params.package)" |
|
64 | 78 | cd $SRC_PATH |
65 | 79 | fi |
66 | 80 | go build $(params.flags) $(params.packages) |
67 | | - env: |
68 | | - - name: GOOS |
69 | | - value: "$(params.GOOS)" |
70 | | - - name: GOARCH |
71 | | - value: "$(params.GOARCH)" |
72 | | - - name: GO111MODULE |
73 | | - value: "$(params.GO111MODULE)" |
74 | | - - name: GOCACHE |
75 | | - value: "$(params.GOCACHE)" |
76 | | - - name: GOMODCACHE |
77 | | - value: "$(params.GOMODCACHE)" |
78 | | - - name: CGO_ENABLED |
79 | | - value: "$(params.CGO_ENABLED)" |
80 | | - - name: GOSUMDB |
81 | | - value: "$(params.GOSUMDB)" |
| 81 | + workingDir: $(workspaces.source.path) |
| 82 | + workspaces: |
| 83 | + - name: source |
0 commit comments