diff --git a/.github/actions/default/action.yml b/.github/actions/default/action.yml index 3bb394212..640c0c2c9 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 }} ## Disabling cache for now, as it's slowing down the build. Downloading nix ## dependencies from cache.nixos.org is faster than restoring from the cache. #- name: Cache dependencies diff --git a/.gitignore b/.gitignore index ab67db318..d34121f0f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ Dockerfile.cross charts *.tgz + +.just-lib diff --git a/Justfile b/Justfile index 4f6519a98..3bcf653ad 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,9 @@ set dotenv-load set positional-arguments +import '.just-lib/helm/recipes.just' +export HELM_DIR := "helm" + default: @just --list @@ -40,56 +43,6 @@ generate: generate-mock: go generate -run mockgen ./... -helm-update: - #!/bin/bash - set pipefail -e - - rm -f helm/operator/templates/gen/* - rm -f helm/crds/templates/crds/* - - kustomize build config/default --output helm/operator/templates/gen - kustomize build config/crd --output helm/crds/templates/crds - - # Patch all CRD files to add helm.sh/resource-policy and custom annotations support - for file in helm/crds/templates/crds/*.yaml; do - awk '/controller-gen.kubebuilder.io\/version:/ { - print - print " helm.sh/resource-policy: keep" - print " {{{{- with .Values.annotations }}" - print " {{{{- toYaml . | nindent 4 }}" - print " {{{{- end }}" - next - } 1' "$file" > "$file.tmp" && mv "$file.tmp" "$file" - done - - rm -f helm/operator/templates/gen/v1_namespace*.yaml - rm -f helm/operator/templates/gen/apps_v1_deployment_*.yaml - helm dependencies update ./helm/operator - -helm-validate args='': - for dir in $(ls -d helm/*); do \ - helm lint ./$dir --strict {{args}}; \ - helm template ./$dir {{args}}; \ - done - -helm-package suffix='': helm-update - #!/bin/bash - set -e - for dir in $(ls -d helm/*); do - if [ -n "{{suffix}}" ]; then - version=$(grep '^version:' "$dir/Chart.yaml" | awk '{print $2}' | tr -d '"') - pushd "$dir" && helm package . --version "${version}-{{suffix}}" && popd - else - pushd "$dir" && helm package . && popd - fi - done - -helm-publish suffix='': (helm-package suffix) - echo $GITHUB_TOKEN | docker login ghcr.io -u NumaryBot --password-stdin - for path in $(ls -d helm/*/*.tgz); do \ - helm push ${path} oci://ghcr.io/formancehq/helm; \ - done - generate-docs: mkdir -p "docs/09-Configuration reference" go run github.com/elastic/crd-ref-docs@v0.2.0 \ diff --git a/flake.lock b/flake.lock index 977f4c860..1c9255ea1 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": 1773068389, @@ -72,6 +89,7 @@ }, "root": { "inputs": { + "just-lib": "just-lib", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur" diff --git a/flake.nix b/flake.nix index 54abefa40..faa397d88 100644 --- a/flake.nix +++ b/flake.nix @@ -9,9 +9,11 @@ url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs"; }; + + just-lib = { url = "github:formancehq/just-lib/feat/actions-and-tests"; flake = false; }; }; - outputs = { self, nixpkgs, nixpkgs-unstable, nur }: + outputs = { self, nixpkgs, nixpkgs-unstable, nur, just-lib }: let supportedSystems = [ "x86_64-linux" @@ -46,7 +48,6 @@ go_1_26 gotools just - kubernetes-helm kustomize_4 setup-envtest yq @@ -60,7 +61,12 @@ in { default = pkgs.mkShell { - packages = stablePackages ++ unstablePackages ++ otherPackages; + shellHook = '' + ln -sfn ${just-lib} .just-lib + source ${just-lib}/helm/setup-plugins.sh + ''; + packages = stablePackages ++ unstablePackages ++ otherPackages + ++ (import "${just-lib}/helm/pkgs.nix" { inherit pkgs; }); }; } );