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

Feat/lint issue #310

Closed
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.9

- name: Install chart-testing
uses: helm/chart-testing-action@v2.0.1
Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: ct-lint
name: Chart Testing Lint
entry: ct lint --all --check-version-increment=false --use-helmignore
language: system
pass_filenames: false
files: ^charts/
always_run: true
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

[This Repository](https://github.com/open-metadata/openmetadata-helm-charts) houses Kubernetes [Helm](https://helm.sh) charts for deploying [Open Metadata](https://github.com/open-metadata/OpenMetadata) and it's dependencies (Elastic Search and MySQL) on a Kubernetes Cluster.

---

## Setup


Expand All @@ -29,6 +31,8 @@ Install the below tools:
- [Kubectl](https://kubernetes.io/docs/tasks/tools/) to manage Kubernetes Resources
- [Helm](https://helm.sh) to deploy resources based on Helm Charts from this repository. Note, we only support Helm 3

---

## Quickstart

Assuming kubectl context points to the correct kubernetes cluster, first create kubernetes secrets that contain MySQL and Airflow passwords as secrets.
Expand Down Expand Up @@ -103,6 +107,47 @@ To expose the Openmetadata UI locally, run the below command -
kubectl port-forward deployment/openmetadata 8585:8585
```

---

## Setting Up Chart Testing Lint with Pre-commit Hook
#### Why Chart Testing Lint?
When working with Helm charts, it's important to ensure that they meet best practices, are free from errors, and follow the defined guidelines. **Chart Testing (ct) Lint** is a tool designed to automate this process by linting your Helm charts before committing them to the repository. It helps to:
- Catch errors early.
- Enforce best practices in chart development.
- Automatically validate changes to Helm charts during pull requests or commits.


This guide will show you how to integrate `chart-testing` linting into your pre-commit hooks to automatically lint charts before committing them. It also allows you to manually trigger linting when needed.

#### Prerequisites
Before setting up the pre-commit hook, make sure you have the following dependencies installed:

##### 1. Install `chart-testing`
`chart-testing` is a command-line tool used to lint and validate Helm charts. It can be installed using **Homebrew** on macOS.

To install `chart-testing`, run the following command:

```bash
brew install chart-testing
```
##### 2. Install `pre-commit`
To install the pre-commit tool, run:
```bash
pip install pre-commit
```
#### Setting Up Pre-commit Hook for Chart Testing Lint
##### 1. Install the Pre-commit Hook
Once the dependencies are installed, navigate to your repository and run the following command to install the pre-commit hook:
```bash
pre-commit install
```
This will set up the pre-commit hook in the .git/hooks directory of your repository.
##### 2. Manually Trigger the Linting Process
If you need to manually trigger the linting of charts at any time, navigate to the root of your repository and run:
```bash
ct lint --all --check-version-increment=false --use-helmignore
```
---
## Documentation and Support

Check out [OpenMetadata documentation](https://docs.open-metadata.org/) for a complete description of OpenMetadata's features.
Expand Down
Loading