From 68e19d490b940916b92bf01cd47e2fe58260a8d1 Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Tue, 31 Mar 2026 14:36:16 +0200 Subject: [PATCH 1/2] feat: import shared helm recipes from formancehq/just-lib Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitignore | 3 +- Justfile | 139 ++--------------------------------------------------- flake.nix | 11 +++-- 3 files changed, 14 insertions(+), 139 deletions(-) diff --git a/.gitignore b/.gitignore index a557fdc8..9d797ec2 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ charts/**/LICENSE .ci -docs \ No newline at end of file +docs +.just-lib diff --git a/Justfile b/Justfile index a1b6654a..19af28d3 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,9 @@ set dotenv-load set positional-arguments +import '.just-lib/helm/recipes.just' +export HELM_DIR := "charts" + default: @just --list @@ -13,46 +16,6 @@ lint: tidy: lint @cd ./tools/readme && go mod tidy -helm-schema-install: - helm plugin install https://github.com/losisin/helm-values-schema-json.git --version v1.9.2 || true - -helm-schema path='': - helm schema -input {{path}}/values.yaml -output {{path}}/values.schema.json - -helm-docs: - go run github.com/norwoodj/helm-docs/cmd/helm-docs@v1.14 --chart-search-root=charts --document-dependency-values --skip-version-footer - -helm-all package="false" publish='false' packageArgs="": helm-docs helm-schema-install - #!/bin/bash - set -euo pipefail - - charts=$(find ./charts -name Chart.yaml | xargs -n1 dirname) - - # Phase 1: Update dependencies sequentially to avoid race conditions on shared subcharts - for chart in $charts; do - just helm-schema "$chart" - just helm-update "$chart" - done - - # Phase 2: Lint, template, and package in parallel (dependencies are already resolved) - for chart in $charts; do - ( - if [ "{{package}}" = "true" ]; then - just helm-package-only "$chart" {{packageArgs}} - else - just helm-template-only "$chart" - fi - ) & - done - wait - if [ "{{publish}}" = "true" ]; then - for chart in $(find ./build -name "*.tgz"); do - ( - just helm-publish "$chart" - ) - done - fi - template-readme: tidy #!/bin/bash pushd ./tools/readme @@ -62,100 +25,6 @@ template-readme: tidy --template-file contributing.tpl > ../../CONTRIBUTING.md popd -helm-update path='' args='': helm-login - #!/bin/bash - set -e - - update_chart() { - local chart_dir="$1" - - echo "🔍 Checking $chart_dir" - - if [[ ! -f "$chart_dir/Chart.yaml" ]]; then - echo "❌ No Chart.yaml in $chart_dir" - return - fi - - local deps - deps=$(helm dependency list "$chart_dir" 2>/dev/null | grep 'file://' | awk '{print $1, $2, $3}' || true) - - while read -r name version repo; do - if [[ "$repo" == file://* ]]; then - local subchart_path - subchart_path=$(echo "$repo" | sed 's|file://||') - local full_path="$chart_dir/$subchart_path" - update_chart "$full_path" - fi - done <<< "$deps" - - echo "🔗 helm dependency update $chart_dir {{args}}" - helm dependency update "$chart_dir" {{args}} > /dev/null - } - - update_chart {{path}} - -helm-lint path='' args="": - #!/bin/bash - set -euo pipefail - just helm-update {{path}} - echo "📝 Linting chart {{path}}" - helm lint {{path}} --strict - -helm-template path='' args='' output='/dev/null': - #!/bin/bash - set -euo pipefail - just helm-lint {{path}} - - isLibrary=$(yq -r '.type' {{path}}/Chart.yaml) - echo "Chart type: $isLibrary" - if [ "$isLibrary" = "library" ]; then - echo "❌ Skipping template for library chart" - else - echo "✨ Rendering chart {{path}} on {{output}}" - helm template {{path}} {{args}} > {{output}} - fi - -helm-template-only path='' args='' output='/dev/null': - #!/bin/bash - set -euo pipefail - echo "📝 Linting chart {{path}}" - helm lint {{path}} --strict - - isLibrary=$(yq -r '.type' {{path}}/Chart.yaml) - echo "Chart type: $isLibrary" - if [ "$isLibrary" = "library" ]; then - echo "❌ Skipping template for library chart" - else - echo "✨ Rendering chart {{path}} on {{output}}" - helm template {{path}} {{args}} > {{output}} - fi - -helm-package path='' args='': - just helm-template {{path}} - helm package {{path}} --destination ./build {{args}} - -helm-package-only path='' args='': - #!/bin/bash - set -euo pipefail - echo "📝 Linting chart {{path}}" - helm lint {{path}} --strict - - isLibrary=$(yq -r '.type' {{path}}/Chart.yaml) - echo "Chart type: $isLibrary" - if [ "$isLibrary" = "library" ]; then - echo "❌ Skipping template for library chart" - else - echo "✨ Rendering chart {{path}}" - helm template {{path}} > /dev/null - fi - helm package {{path}} --destination ./build {{args}} - -helm-publish path='': helm-login - helm push {{path}} oci://ghcr.io/formancehq/helm - -helm-login: - echo $GITHUB_TOKEN | helm registry login ghcr.io -u NumaryBot --password-stdin || true - release: #!/bin/bash set -euo pipefail @@ -171,4 +40,4 @@ release: --config {{justfile_directory()}}/cr.yaml \ --token ${GITHUB_TOKEN} \ --skip-existing \ - --package-path {{justfile_directory()}}/build \ No newline at end of file + --package-path {{justfile_directory()}}/build diff --git a/flake.nix b/flake.nix index 163a6ee0..0949fe22 100644 --- a/flake.nix +++ b/flake.nix @@ -8,9 +8,11 @@ url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs"; }; + + just-lib = { url = "git+ssh://git@github.com/formancehq/just-lib"; flake = false; }; }; - outputs = { self, nixpkgs, nur }: + outputs = { self, nixpkgs, nur, just-lib }: let goVersion = 23; @@ -42,6 +44,9 @@ devShells = forEachSupportedSystem ({ pkgs, system }: { default = pkgs.mkShell { + shellHook = '' + ln -sfn ${just-lib} .just-lib + ''; packages = with pkgs; [ go gotools @@ -49,11 +54,11 @@ ginkgo pkgs.nur.repos.goreleaser.goreleaser-pro just - kubernetes-helm kustomize_4 mockgen yq - ]; + ] + ++ (import "${just-lib}/helm/pkgs.nix" { inherit pkgs; }); }; } ); From c475bb3a043510e092dd848b9cc5815149db3614 Mon Sep 17 00:00:00 2001 From: David Ragot <35502263+Dav-14@users.noreply.github.com> Date: Thu, 2 Apr 2026 13:59:52 +0200 Subject: [PATCH 2/2] fix: use github: flake URL + access-tokens for private just-lib Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/actions/default/action.yml | 8 +++++++- flake.lock | 18 ++++++++++++++++++ flake.nix | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/actions/default/action.yml b/.github/actions/default/action.yml index 29614e78..d3aa182c 100644 --- a/.github/actions/default/action.yml +++ b/.github/actions/default/action.yml @@ -9,6 +9,9 @@ runs: steps: - name: Install Nix uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + access-tokens = github.com=${{ inputs.token }} - name: Cache dependencies uses: nix-community/cache-nix-action@v7 with: @@ -24,4 +27,7 @@ runs: /tmp/go/pkg/mod/ key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-${{ github.job }}-go- \ No newline at end of file + ${{ runner.os }}-${{ github.job }}-go- + - name: Warm nix shell + shell: bash + run: nix develop --impure --command true \ No newline at end of file diff --git a/flake.lock b/flake.lock index 78e09e2f..99278e22 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,23 @@ "type": "github" } }, + "just-lib": { + "flake": false, + "locked": { + "lastModified": 1775050988, + "narHash": "sha256-8JEACb/nm2o3pWQtSB3axaLnTpPPvDT03GvR5DHihQA=", + "owner": "formancehq", + "repo": "just-lib", + "rev": "5708b133512d8670e29920819a80acd4c192ee28", + "type": "github" + }, + "original": { + "owner": "formancehq", + "ref": "feat/actions-and-tests", + "repo": "just-lib", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1742422364, @@ -59,6 +76,7 @@ }, "root": { "inputs": { + "just-lib": "just-lib", "nixpkgs": "nixpkgs", "nur": "nur" } diff --git a/flake.nix b/flake.nix index 0949fe22..3e5eedf8 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - just-lib = { url = "git+ssh://git@github.com/formancehq/just-lib"; flake = false; }; + just-lib = { url = "github:formancehq/just-lib/feat/actions-and-tests"; flake = false; }; }; outputs = { self, nixpkgs, nur, just-lib }: