From bc48ec738b1963dcc07ada7e9c367a03a4c1e15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 25 Dec 2024 20:36:50 +0100 Subject: [PATCH] vars: commit validation hashes --- pkgs/clan-cli/clan_cli/vars/_types.py | 3 ++- pkgs/clan-cli/clan_cli/vars/generate.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/clan-cli/clan_cli/vars/_types.py b/pkgs/clan-cli/clan_cli/vars/_types.py index 9a81068bb..f06f68ffc 100644 --- a/pkgs/clan-cli/clan_cli/vars/_types.py +++ b/pkgs/clan-cli/clan_cli/vars/_types.py @@ -132,13 +132,14 @@ class StoreBase(ABC): return None return hash_file.read_text().strip() - def set_validation(self, generator: "Generator", hash_str: str) -> None: + def set_validation(self, generator: "Generator", hash_str: str) -> Path: """ Store the invalidation hash that indicates if a generator needs to be re-run """ hash_file = self.directory(generator, ".validation-hash") hash_file.parent.mkdir(parents=True, exist_ok=True) hash_file.write_text(hash_str) + return hash_file def hash_is_valid(self, generator: "Generator") -> bool: """ diff --git a/pkgs/clan-cli/clan_cli/vars/generate.py b/pkgs/clan-cli/clan_cli/vars/generate.py index bad8478c1..3cb35f51a 100644 --- a/pkgs/clan-cli/clan_cli/vars/generate.py +++ b/pkgs/clan-cli/clan_cli/vars/generate.py @@ -236,9 +236,17 @@ def execute_generator( files_to_commit.append(file_path) if generator.validation is not None: if public_changed: - public_vars_store.set_validation(generator, generator.validation) + files_to_commit.append( + public_vars_store.set_validation( + generator, generator.validation + ) + ) if secret_changed: - secret_vars_store.set_validation(generator, generator.validation) + files_to_commit.append( + secret_vars_store.set_validation( + generator, generator.validation + ) + ) commit_files( files_to_commit, machine.flake_dir,