github.com/diadata-org/diadata@v1.4.593/.tekton/Task.Golang-build.yaml (about)

     1  apiVersion: tekton.dev/v1beta1
     2  kind: Task
     3  metadata:
     4    name: golang-build
     5    namespace: tekton-pipelines
     6    labels:
     7      app.kubernetes.io/version: "0.1"
     8    annotations:
     9      tekton.dev/pipelines.minVersion: "0.12.1"
    10      tekton.dev/tags: build-tool
    11      tekton.dev/displayName: "golang build"
    12  spec:
    13    description: >-
    14      This Task is Golang task to build Go projects.
    15    params:
    16      - name: package
    17        description: base package to build in
    18        default: ""
    19      - name: packages
    20        description: "packages to build (default: ./cmd/...)"
    21        default: "./cmd/..."
    22      - name: version
    23        description: golang version to use for builds
    24        default: "1.14.15"
    25      - name: flags
    26        description: flags to use for the test command
    27        default: -v
    28      - name: GOOS
    29        description: "running program's operating system target"
    30        default: linux
    31      - name: GOARCH
    32        description: "running program's architecture target"
    33        default: amd64
    34      - name: GO111MODULE
    35        description: "value of module support"
    36        default: auto
    37    resources:
    38      inputs:
    39          - name: git-source
    40            type: git
    41            targetPath: src/
    42    steps:
    43      - name: build
    44        image: docker.io/library/golang:$(params.version)
    45        script: |
    46          SRC_PATH="$(resources.inputs.git-source.path)/$(params.package)"
    47          cd $SRC_PATH
    48          rm -rf vendor
    49          go build $(params.flags) $(params.packages)
    50          go mod vendor
    51          go mod tidy
    52        env:
    53          - name: GOPATH
    54            value: /workspace
    55          - name: GOOS
    56            value: "$(params.GOOS)"
    57          - name: GOARCH
    58            value: "$(params.GOARCH)"
    59          - name: GO111MODULE
    60            value: "$(params.GO111MODULE)"