stackrox / kube-linter

KubeLinter is a static analysis tool that checks Kubernetes YAML files and Helm charts to ensure the applications represented in them adhere to best practices.
https://docs.kubelinter.io/
Apache License 2.0
2.97k stars 234 forks source link

Add more CI/CD Integration examples #493

Open mclarkex opened 1 year ago

mclarkex commented 1 year ago

Description of the problem/feature request Provide more examples of how to integrate kube-linter into other CI/CD tools for wider adoption and usage.

Description of the existing behavior vs. expected behavior

Current documentation is limited regarding how to integrate with other CI/CD tools.

I've provided a working example of getting kube-linting working for Kubernetes and Helm within Concourse CI Concourse is a popular Go-based CI tool used at a lot of large organisations.

  1. Create a new resource_type:

resource_types:
 - name: kubelinter-image
    type: docker-image 
    source: 
      repository: stackrox/kube-linter 
      tag: latest
  1. Create a resource where your Kubernetes for helm files are stored

2. Create a new job pulling in your Kubernetes or helm files 

```yaml
jobs:
- name: kube-linting
  plan:
    - get: platform-code #Your repository with 
      trigger: true 
    - task: kube-linting
      config:
        platform: linux
        image_resource:
          type: docker-image
          source:
            repository: stackrox/kube-linter 
            tag: latest
        inputs:
          - name: platform-code
        run: 
          path: /kube-linter 
          args: 
          - lint
          - platform-code/kubernetes/kubernetes-manifiest.yaml

Syntax error image

Working Example Output: image

Additional context

This is a relatively simple issue, I would like to raise a PR to add it into the ReadMes, but if accepted I will raise a PR with Concourse to add kube-linter to a list of valid resource types as outlined here: https://github.com/concourse/resource-types and here https://resource-types.concourse-ci.org/

Will provide an example for Azure DevOps aswell.

manishramanandi commented 1 month ago

Hey can you explain me more about it i want to contribute