Skip to content

Latest commit

 

History

History
 
 

golang

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Golang tasks

These Tasks are Golang task to build, test and validate Go projects.

Install the tasks

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/golang/lint.yaml
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/golang/build.yaml
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/v1beta1/golang/tests.yaml

golangci-lint

Parameters

  • package: base package under validation
  • flags: flags to use for golangci-lint command (default:--verbose)
  • version: golangci-lint version to use (default: v1.16)
  • GOOS: operating system target (default: linux)
  • GOARCH: architecture target (default: amd64)
  • GO111MODULE: value of module support (default: auto)

Workspaces

  • source: A git-type PipelineResource specifying the location of the source to build.

golang-build

Parameters

  • package: base package under test
  • packages: packages to test (default: ./...)
  • version: golang version to use for tests (default: latest)
  • flags: flags to use for go build command (default: -v)
  • GOOS: operating system target (default: linux)
  • GOARCH: architecture target (default: amd64)
  • GO111MODULE: value of module support (default: auto)

Workspaces

  • source: A git-type PipelineResource specifying the location of the source to build.

golang-test

Parameters

  • package: base package to build in
  • packages: packages to test (default: ./cmd/...)
  • version: golang version to use for builds (default: latest)
  • flags: flags to use for go test command (default: -race -cover -v)
  • GOOS: operating system target (default: linux)
  • GOARCH: architecture target (default: amd64)
  • GO111MODULE: value of module support (default: auto)

Workspaces

  • source: A git-type PipelineResource specifying the location of the source to build.

Usage

golangci-lint

This TaskRun runs the Task to validate tektoncd/pipeline pkg package with golangci-lint.

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: lint-my-code
spec:
  taskRef:
    name: golangci-lint
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source
  params:
  - name: package
    value: github.com/tektoncd/pipeline
  - name: flags
    value: --verbose

golang-test

This TaskRun runs the Task to run unit-tests on tektoncd/pipeline.

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: test-my-code
spec:
  taskRef:
    name: golang-test
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source
  params:
  - name: package
    value: github.com/tektoncd/pipeline
  - name: packages
    value: ./pkg/...

golang-build

This TaskRun runs the Task to compile commands from tektoncd/pipeline. golangci-lint.

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: build-my-code
spec:
  taskRef:
    name: golang-build
  workspaces:
  - name: source
    persistentVolumeClaim:
      claimName: my-source
  params:
  - name: package
    value: github.com/tektoncd/pipeline