Skip to content

Conversation

viveksinghggits
Copy link
Contributor

@viveksinghggits viveksinghggits commented Sep 12, 2025

Summary

Whenever we raised PR in to helm chart repo CI failed there because we had linting issues in our helm chart. A previous PR that I raised fixed the linting problem. But we should have a linting mechanism in our CI that would consistently check if we have made any mistake in our charts. This PR does that.

The chart_schema.yaml and lintconf.yaml are the default yaml files using which ct should be run. And ct is the tool that is used for linting in our helm charts repo.

Proof of Work

Passing lint_repo task here https://spruce.mongodb.com/version/68c43aae1d5d5d000770c624/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC and in this PR as well.

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you added changelog file?

Somehow all the efforts to set path env var using below code

```
- command: subprocess.exec
      type: test
      params:
        add_to_path:
          - ${workdir}/bin
          - ${workdir}/venv/bin
        working_dir: src/github.com/mongodb/mongodb-kubernetes
        binary: scripts/evergreen/lint_helm_chart.sh
```
I even tried to remove `subprocess.exec` and use `shell.exec` and used
`env:` for params, that didn't work as well. that's why we are finally
settling on to setting path at the lowest level. Otherwise `ct` CLI resulted
into `yamale` and `yamllint` are not found.
@viveksinghggits viveksinghggits requested a review from a team as a code owner September 12, 2025 15:42
@viveksinghggits viveksinghggits added the skip-changelog Use this label in Pull Request to not require new changelog entry file label Sep 12, 2025
Copy link

⚠️ (this preview might not be accurate if the PR is not rebased on current master branch)

MCK 1.3.1 Release Notes

Copy link
Collaborator

@MaciejKaras MaciejKaras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, still I have one general ask.

When we add or change logic in our linting requirements we should also consider adding them to .githooks/pre-commit. Otherwise there is no way locally to lint the helm charts.

Secondly we should make scripts that are run in EVG CI easy to run locally as well. I wouldn't put them in scripts/evergreen/ directory, but in scripts/helm and make them available for developers. I think also .githooks/pre-commit takes care of installing all prerequisite applications.

@@ -420,3 +420,8 @@ prepare-local-olm-e2e:

prepare-operator-configmap: # prepares the local environment to run a local operator
source scripts/dev/set_env_context.sh && source scripts/funcs/printing && source scripts/funcs/operator_deployment && prepare_operator_config_map "$(kubectl config current-context)"

# Lint the helm chart using helm chart-testing tool (`ct`) using the default configuration available at `helm_chart/tests/schemas/`
lint-chart:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about target for installing chart-testing locally?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both scripts should not be in scripts/evergreen/ dir, they can be used outside of evg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Use this label in Pull Request to not require new changelog entry file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants