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

Support helm lint #429

Closed
cgetzen opened this issue Apr 23, 2021 · 11 comments · Fixed by #2386
Closed

Support helm lint #429

cgetzen opened this issue Apr 23, 2021 · 11 comments · Fixed by #2386
Labels
enhancement New feature or request

Comments

@cgetzen
Copy link

cgetzen commented Apr 23, 2021

None of the yaml linters or kubeval support helm

@cgetzen cgetzen added the enhancement New feature or request label Apr 23, 2021
@nvuillam
Copy link
Member

Do you have a helm linter to propose ?

@cgetzen
Copy link
Author

cgetzen commented Apr 28, 2021

@nvuillam
Copy link
Member

I'm not (yet) familiar with helm, please could you provide:

  • example calls for helm lint
  • a valid helm file
  • an invalid helm file

Thanks !

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Jun 15, 2021
@ThomasSanson
Copy link
Contributor

Hello,

I would like to incorporate the "helm lint" feature into megalinter.

@nvuillam Here are some example calls for helm lint:

# Lint a single chart
helm lint mychart

# Lint all charts in a chart directory
helm lint chartdirectory

# Lint a chart and print the output to a file
helm lint mychart > lint-output.txt

A valid Helm chart file might look something like this:

apiVersion: v2
name: mychart
version: 1.0.0

# A chart can contain one or more charts
charts:
  # This is the name of the chart
  - name: myapp
    # The chart version
    version: 1.0.0
    # A chart can contain one or more templates
    templates:
      # The name of the template
      - name: deployment.yaml
        # The template content
        content: |
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: myapp-deployment
          spec:
            replicas: 3
            selector:
              matchLabels:
                app: myapp
            template:
              metadata:
                labels:
                  app: myapp
              spec:
                containers:
                  - name: myapp
                    image: myapp:latest
                    ports:
                      - containerPort: 80

An invalid Helm chart file might have a syntax error or be missing required fields, for example:

apiVersion: v2
name: mychart

# A chart is missing the 'version' field

# A chart can contain one or more charts
charts:
  # This is the name of the chart
  - name: myapp
    # The chart version
    version: 1.0.0
    # A chart can contain one or more templates
    templates:
      # The name of the template
      - name: deployment.yaml
        # The template content
        content: |
          apiVersion: apps/v1
          kind: Deployment
          metadata:
            name: myapp-deployment
          spec:
            replicas: 3
            selector:
              matchLabels:
                app: myapp
            template:
              metadata:
                labels:
                  app: myapp
              spec:
                containers:
                  - name: myapp
                    image: myapp:latest
                    ports:
                      - containerPort: 80

I hope this helps! Let me know if you have any other questions.

If you would like, I am willing to try making a pull request to include this new linter.

@nvuillam nvuillam reopened this Dec 27, 2022
@nvuillam
Copy link
Member

nvuillam commented Dec 27, 2022

@ThomasSanson that would be great :)

You can start your PR and we'll provide support if necessary :)

Instructions to add a linter: https://megalinter.io/latest/contributing/#add-a-new-linter

Example of recent PR with a new linter, by @bdovaz : #2150 (don't be scared by the number of files, most of them are automatically generated, updates are mainly in descriptor file. I suggest you add helm lint in KUBERNETES descriptor -> https://github.com/oxsecurity/megalinter/blob/main/megalinter/descriptors/kubernetes.megalinter-descriptor.yml )

@github-actions github-actions bot removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Dec 28, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Jan 27, 2023
@nvuillam nvuillam removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Jan 28, 2023
@nvuillam
Copy link
Member

@ThomasSanson are you still interested in providing a PR ? :)

@ThomasSanson
Copy link
Contributor

ThomasSanson commented Feb 7, 2023

@ThomasSanson are you still interested in providing a PR ? :)

@nvuillam Yes, I'm planning to do it this Sunday due to lack of time

@nvuillam
Copy link
Member

nvuillam commented Feb 7, 2023

Great :)

@ThomasSanson
Copy link
Contributor

In progress, I've been sick...

However, I find it challenging to fully comprehend what actions I need to take to make a meaningful contribution. Despite this, I am committed to doing my best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants