1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/task/ruby-lint/0.1
PuneetPunamiya 5a3e5f630f Adds category field as an annotation as tekton.dev/categories
- Initially all tags were mapped to categories in Hub,
     for e.g. config.yaml: https://github.com/tektoncd/hub/blob/master/config.yaml,
     so whenever a new tag was added in a task it was mapped to a category called `others`.
     Hence before every release we had to manually map these new tags to some category,
     hence after the discussion in Catalog and Hub WG, a proposal was created for adding
     a category as an annotation.

   - PR to update the TEP-0003-Tekton Catalog Organization: https://github.com/tektoncd/community/pull/352

Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
2021-07-26 13:15:08 +01:00
..
tests Add add_task helper function for tests 2020-10-07 17:51:55 +01:00
README.md Update self reference from master to main 🧙 2021-03-19 11:09:49 +00:00
ruby-lint.yaml Adds category field as an annotation as tekton.dev/categories 2021-07-26 13:15:08 +01:00

Ruby Linter

The following task is used to provide static analysis on YAML files mounted using rubocop (Ruby linter).

Installing the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/ruby-lint/0.1/ruby-lint.yaml

Parameters

  • args: The extra params along with the file path needs to be provided as the part of args. (Default: ["--help"])

Workspaces

  • shared-workspace : The workspace containing files on which we want to apply linter check. It can be a shared workspace with the git-clone task or a ConfigMap mounted containing some files.

Usage

  1. Create the git-clone task
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/git-clone/0.1/git-clone.yaml
  1. Create the PVC

  2. Apply the required tasks

  3. Create the Pipeline and PipelineRun for Ruby linter

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: linter-pipeline
spec:
  workspaces:
    - name: shared-workspace
  tasks:
    - name: fetch-repository
      taskRef:
        name: git-clone
      workspaces:
        - name: output
          workspace: shared-workspace
      params:
        - name: url
          value: https://github.com/vinamra28/tekton-linter-test
        - name: revision
          value: "linter-test"
        - name: subdirectory
          value: ""
        - name: deleteExisting
          value: "true"
    - name: ruby-lint-run #lint ruby script
      taskRef:
        name: ruby-lint
      runAfter:
        - fetch-repository
      workspaces:
        - name: shared-workspace
          workspace: shared-workspace
      params:
        - name: args
          value: ["-P", "-E", "."]

---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: linter-pipeline-run
spec:
  pipelineRef:
    name: linter-pipeline
  workspaces:
    - name: shared-workspace
      persistentvolumeclaim:
        claimName: linter-pvc

NOTE: Pipeline will go into failed state if the linter check fails.