Skip to content

Add global justfile with helm-template recipe (~/.config/just/justfile) #13

Description

@swibrow

What

Import a global just justfile that lives at ~/.config/just/justfile and provides a helm-template recipe for rendering any Helm chart folder from anywhere via just -g helm-template <chart-dir>.

Set up ad-hoc on my work machine — capturing here so chezmoi manages it.

Where it goes (chezmoi)

New file: dot_config/just/justfile → renders to ~/.config/just/justfile (the first path just -g searches).

File contents

# Global justfile — run from anywhere with `just -g <recipe>`.

# Render a Helm chart's manifests to stdout. Builds chart dependencies first
# (so charts with `dependencies:` like ghcr.io/dnd-it/helm-charts work).
#
# Usage:
#   just -g helm-template <chart-dir> [extra helm args...]
#
# Examples:
#   just -g helm-template deploy/app
#   just -g helm-template deploy/app -f deploy/app/envs/prod/values.yaml
helm-template chart='.' *args='':
    #!/usr/bin/env bash
    set -euo pipefail
    cd "{{invocation_directory()}}"
    chart="{{chart}}"
    name="$(basename "$(cd "$chart" && pwd)")"
    helm dependency build "$chart" >/dev/null
    helm template "$name" "$chart" {{args}}

Notes

  • Uses invocation_directory() so relative chart paths resolve against the dir you ran the command in, not the justfile's home location (the usual just -g gotcha).
  • Runs helm dependency build first so charts with OCI dependencies render out of the box.
  • Forwards extra args (-f, --set, …) straight through to helm template.
  • Dependencies just and helm are already in the Brewfile — no Brewfile change needed.

Acceptance

  • dot_config/just/justfile added and applied by chezmoi
  • just -g helm-template <chart-dir> renders a chart from an arbitrary working directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions