helm / chart-testing-action

A GitHub Action to lint and test Helm charts
https://github.com/helm/chart-testing
Apache License 2.0
251 stars 71 forks source link

Where should i set the path to the chart #21

Closed jwillker closed 4 years ago

jwillker commented 4 years ago

HI!

I'm having a problem with the CI not correctly identifying the Chart directory

What I tried:

My workflow file:

name: Helm

on:
  pull_request:
    paths:
      - 'Charts/generic/**'
jobs:
  Lint:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Run chart-testing (lint)
        id: lint
        uses: helm/chart-testing-action@v1.0.0-alpha.3
        with:
          command: lint

What I hope will happen:

Run the lint only in Charts/generic directory.

How to configure this?

unguiculus commented 4 years ago

chart-testing searches charts in directory charts by default. You can reconfigure this with a config file:

ct.yaml

chart-dirs:
  - my-chart-dir
- name: Run chart-testing (lint)
  id: lint
  uses: helm/chart-testing-action@v1.0.0-alpha.3
  with:
    command: lint
    config: ct.yaml

See:

jwillker commented 4 years ago

chart-testing searches charts in directory charts by default. You can reconfigure this with a config file:

ct.yaml

chart-dirs:
  - my-chart-dir
- name: Run chart-testing (lint)
  id: lint
  uses: helm/chart-testing-action@v1.0.0-alpha.3
  with:
    command: lint
    config: ct.yaml

See:

Thanks! This works for me

devth commented 4 years ago

Is it a requirement to have charts in a subdirectory vs a single top-level chart?

My current structure, for example:

.
├── Chart.lock
├── Chart.yaml
├── README.md
├── charts
│   └── postgresql-8.6.12.tgz
├── ct.yaml
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── config.yaml
│   ├── deployment.yaml
│   ├── ingress.yaml
│   ├── service.yaml
│   ├── serviceaccount.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml

This is what you get when you generate with helm create mychart.

devth commented 4 years ago

Found the answer to this chatting on Slack.

Conclusion is that it's conventional to put charts in the charts dir instead of top level repo, so I am restructuring to:

.
├── README.md
├── charts
│   └── yetibot
│       ├── Chart.lock
│       ├── Chart.yaml
│       ├── charts
│       │   └── postgresql-8.6.12.tgz
│       ├── templates
│       │   ├── NOTES.txt
│       │   ├── _helpers.tpl
│       │   ├── config.yaml
│       │   ├── deployment.yaml
│       │   ├── ingress.yaml
│       │   ├── service.yaml
│       │   ├── serviceaccount.yaml
│       │   └── tests
│       │       └── test-connection.yaml
│       └── values.yaml
└── ct.yaml

See charts-repo-actions-demo as an example.

Thanks @scottrigby!