Skip to content

Dev 9359 support additional chart operations#61

Merged
facetoe merged 12 commits into
mainfrom
DEV-9359-support-additional-chart-operations
Jul 20, 2026
Merged

Dev 9359 support additional chart operations#61
facetoe merged 12 commits into
mainfrom
DEV-9359-support-additional-chart-operations

Conversation

@facetoe

@facetoe facetoe commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

To support building solid and testable CI workflows for our org wide helm efforts, extend the local-k8s (soon to be renamed) tool with the necessary additional functionality. There are basically two sets of changes here. The first, is a number of new commands added:

  • local-k8s chart metadata - > parse Chart.yaml
  • local-k8s chart list-changed -> discover charts that need testing
  • local-k8s chart lint -> execute ct lint
  • local-k8s chart push -> push to GHCR
  • local-k8s chart testing -> execute kind tests
  • local-k8s tools path -> emit path of our installed tools for caching, referecing

These are used in the workflows here - zepben/.github#114. The basic idea idea is to write the commands so they can be tested, and also ensure they emit data in a way that is easy to consume in the workflows. We want to avoid bash and grep and all those nasties as much as possible. Instead, we emit structured JSON. In addition to adding these commands, we also renamed the command group from the cryptic ct to chart.

The second sets of changes are some improvements to the program and test structure. Mostly refactoring execute to be more flexible, and return a CommandResult object, and cleaning up the tests with a FakeExecute implementation to reduce the developing coupling on order of cli calls, which is brittle and makes for annoying later refactors.

There are a large number of changed files, however each commit is a single, atomic unit. Reviewing commit by commit should hopefully make sense, and not be overwhelming. If however this PR is too large, I can break it up. Just let me know.

@alourie
alourie self-requested a review July 16, 2026 06:16
@alourie

alourie commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

lol, finger slipped, not approved in draft ;-)

@facetoe
facetoe force-pushed the DEV-9359-support-additional-chart-operations branch 2 times, most recently from c4e8ecc to b3ea508 Compare July 16, 2026 06:41
Comment thread local-k8s/src/local_k8s/commands/chart/push.py
@facetoe
facetoe force-pushed the DEV-9359-support-additional-chart-operations branch 5 times, most recently from 0cdc44c to 18c9e72 Compare July 17, 2026 02:00
facetoe added 3 commits July 17, 2026 03:37
This will be used in the workflows for extracting the metadata.

Signed-off-by: William Coe <william.coe@zepben.com>
This will be used in the CI workflows for determining what we need to
test/package. We assume that git is available on dev/CI machines.

Signed-off-by: William Coe <william.coe@zepben.com>
This will be used in CI for linting.

Signed-off-by: William Coe <william.coe@zepben.com>
@facetoe
facetoe force-pushed the DEV-9359-support-additional-chart-operations branch from a4e0d08 to 9d98828 Compare July 17, 2026 03:37
@facetoe
facetoe marked this pull request as ready for review July 17, 2026 03:40
@facetoe
facetoe marked this pull request as draft July 17, 2026 03:40
@facetoe
facetoe marked this pull request as ready for review July 17, 2026 04:56
Comment thread local-k8s/src/local_k8s/shared.py Outdated
facetoe added 9 commits July 20, 2026 23:00
We have a growing need for more control over how we execute commands.
Move to using subprocess.run to support this. We also needed a way to
store the results, so create a dataclass CommandResult and update call
sites.

Signed-off-by: William Coe <william.coe@zepben.com>
Add a command for pushing to GHCR registry. We also implement the same
beta workflow as helm-common does, this intended as a drop in
replacement.

We expect that login has already been executed, and the
~/.config/helm/registry/config.json file already created. Note: it is
possible to use .config/containers/auth.json also. They are same
structure.

Signed-off-by: William Coe <william.coe@zepben.com>
This replaces the ct lint-and-install command. We only install
Application charts, and for library ones just lint. Additionally we
accept a --chart param for CI to test a specific chart, however omitting
this leads to all charts being discovered and tested. This is to support
the Makefile invocation as that is what is wanted there.

Drop the ct group as we are all in on charts group now.

Signed-off-by: William Coe <william.coe@zepben.com>
As we've added tests things have got increasingly messy. We are often
mocking execute in various different ways, all of which are brittle to
ordering changes etc. To improve this, implement a FakeExecute helper to
faciliate prefix based faking of the execute command. This helps
readability of the tests, but also removes the ordering requirement that
existed with just mocked calls assertions.

Another common source of boilerplate/noise, was setting up chart dirs
etc. Create some fixtures for these so we don't need to reinvent the
wheel all the time.

Signed-off-by: William Coe <william.coe@zepben.com>
We want CI to use our same tools, so add a simple command it can
exercise to print the path it needs to export to locate them.

Signed-off-by: William Coe <william.coe@zepben.com>
This is necessary as otherwise we won't be able to pull commons from our
internal repo when building charts.

Signed-off-by: William Coe <william.coe@zepben.com>
Path munging is fairly central to the operation of this tool, so
centralise it in a single method. This is implemented such that we can
operate directly on the output of "chart list-changed", or absolute
paths depending on what the caller needs. CI wants the former.

Signed-off-by: William Coe <william.coe@zepben.com>
This is forwarded to ct so we can list changes since a specific
commit/ref.

Signed-off-by: William Coe <william.coe@zepben.com>
In the CI workflows, we need to get the output of the push step to
determine the metadata to stamp on release/chart etc. When we dump loads
of stdout there this becomes harder and we end up with grep and other
shell nasties. Instead, capture stdout and only dump it on failure so we
can see what went wrong in the CI logs.

Signed-off-by: William Coe <william.coe@zepben.com>
@facetoe
facetoe force-pushed the DEV-9359-support-additional-chart-operations branch from 9d98828 to e74e4bf Compare July 20, 2026 23:01
@facetoe
facetoe merged commit adb8413 into main Jul 20, 2026
2 checks passed
@facetoe
facetoe deleted the DEV-9359-support-additional-chart-operations branch July 20, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants