79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
{{- define "common.golangci-lint" }}
|
|
{{- $common := dict "Values" .Values.common -}}
|
|
{{- $noCommon := omit .Values "common" -}}
|
|
{{- $overrides := dict "Values" $noCommon -}}
|
|
{{- $noValues := omit . "Values" -}}
|
|
{{- with merge $noValues $overrides $common -}}
|
|
apiVersion: tekton.dev/v1
|
|
kind: Task
|
|
metadata:
|
|
name: golangci-lint
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
description: This Task is Golang task to validate Go projects.
|
|
params:
|
|
- description: base package (and its children) under validation
|
|
name: package
|
|
type: string
|
|
- default: .
|
|
description: path to the directory to use as context.
|
|
name: context
|
|
type: string
|
|
- default: --verbose
|
|
description: flags to use for the test command
|
|
name: flags
|
|
type: string
|
|
- default: v1.39
|
|
description: golangci-lint version to use
|
|
name: version
|
|
type: string
|
|
- default: linux
|
|
description: running operating system target
|
|
name: GOOS
|
|
type: string
|
|
- default: amd64
|
|
description: running architecture target
|
|
name: GOARCH
|
|
type: string
|
|
- default: auto
|
|
description: value of module support
|
|
name: GO111MODULE
|
|
type: string
|
|
- default: ""
|
|
description: Go caching directory path
|
|
name: GOCACHE
|
|
type: string
|
|
- default: ""
|
|
description: Go mod caching directory path
|
|
name: GOMODCACHE
|
|
type: string
|
|
- default: ""
|
|
description: golangci-lint cache path
|
|
name: GOLANGCI_LINT_CACHE
|
|
type: string
|
|
steps:
|
|
- env:
|
|
- name: GOPATH
|
|
value: /workspace
|
|
- name: GOOS
|
|
value: $(params.GOOS)
|
|
- name: GOARCH
|
|
value: $(params.GOARCH)
|
|
- name: GO111MODULE
|
|
value: $(params.GO111MODULE)
|
|
- name: GOCACHE
|
|
value: $(params.GOCACHE)
|
|
- name: GOMODCACHE
|
|
value: $(params.GOMODCACHE)
|
|
- name: GOLANGCI_LINT_CACHE
|
|
value: $(params.GOLANGCI_LINT_CACHE)
|
|
image: {{ .Values.quayHostname }}/{{ .Values.organizationName}}/golang-lint:$(params.version)
|
|
name: lint
|
|
script: |
|
|
golangci-lint run $(params.flags)
|
|
workingDir: $(workspaces.source.path)/$(params.context)
|
|
workspaces:
|
|
- name: source
|
|
{{- end }}
|
|
{{- end }}
|