Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tekton task to run linting #954

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tekton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ TODO(#538): In #538 or #537 we will update
to invoke these `Pipelines` automatically, but for now we will have to invoke
them manually.

## Pull Request Pipeline

The `Tasks` which are going to make up our Pull Request Pipeline are:

- [`ci-unit-test.yaml`](ci-unit-test.yaml) — This `Task` uses `go
test` to run the Pipeline unit tests.
- [`ci-lint.yaml`](ci-lint.yaml) — This `Task` uses
[`golangci-lint`](https://github.com/golangci/golangci-lint) to
validate the code based on common best practices.

TODO(#922) & TODO(#860): Add the Pipeline and hook it up with Prow,
for now all we have are `Tasks` which we can invoke individually by
creating
[`TaskRuns`](https://github.com/tektoncd/pipeline/blob/master/docs/taskruns.md)
and
[`PipelineResources`](https://github.com/tektoncd/pipeline/blob/master/docs/resources.md).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty ty! 🎉

## Release Pipeline

The `Tasks` which make up our release `Pipeline` are:
Expand Down
25 changes: 25 additions & 0 deletions tekton/ci-lint-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: tekton-pipelines
spec:
type: git
params:
- name: url
value: https://github.com/tektoncd/pipeline # REPLACE with your own fork
- name: revision
value: master # REPLACE with your own commit
---
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: golangci-lint-run
spec:
taskRef:
name: golangci-lint
inputs:
resources:
- name: source
resourceRef:
name: tekton-pipelines

33 changes: 33 additions & 0 deletions tekton/ci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: golangci-lint
spec:
inputs:
params:
- name: package
description: package (and its children) under test
default: github.com/tektoncd/pipeline
- name: flags
description: flags to use for the lint command
bobcatfish marked this conversation as resolved.
Show resolved Hide resolved
default: --verbose
- name: version
description: golangci-lint version to use
default: v1.16
resources:
- name: source
type: git
targetPath: src/${inputs.params.package}
steps:
- name: lint
image: golangci/golangci-lint:${inputs.params.version}
workingdir: /workspace/src/${inputs.params.package}
command:
- /bin/bash
args:
- -c
- "golangci-lint run ${inputs.params.flags}"
env:
- name: GOPATH
value: /workspace