vars: commit validation hashes
This commit is contained in:
@@ -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:
|
||||
"""
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user