Skip to content

Commit ed2b4f8

Browse files
committed
print build date and githash
info if those files are available in the cache
1 parent d22c8ba commit ed2b4f8

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

contentctl/objects/config.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,33 @@ def check_test_data_caches(self) -> Self:
349349
if not self.verbose:
350350
# Ignore the check and error output if we are not in verbose mode
351351
return self
352-
353352
for cache in self.test_data_caches:
354353
cache_path = self.path / cache.base_directory_name
355354
if not cache_path.is_dir():
356355
print(cache.helptext)
357356
else:
358-
print(f"Found attack data cache at {cache_path}")
357+
build_date_file = cache_path / "cache_build_date.txt"
358+
git_hash_file = cache_path / "git_hash.txt"
359+
360+
if build_date_file.is_file():
361+
# This is a cache that was built by contentctl. We can use this to
362+
# determine if the cache is out of date.
363+
with open(build_date_file, "r") as f:
364+
build_date = f"\n**Cache Build Date: {f.read().strip()}"
365+
else:
366+
build_date = ""
367+
if git_hash_file.is_file():
368+
# This is a cache that was built by contentctl. We can use this to
369+
# determine if the cache is out of date.
370+
with open(git_hash_file, "r") as f:
371+
git_hash = f"\n**Repo Git Hash : {f.read().strip()}"
372+
else:
373+
git_hash = ""
374+
375+
print(
376+
f"Found attack data cache at [{cache_path}]{build_date}{git_hash}\n"
377+
)
378+
359379
return self
360380

361381
def map_to_attack_data_cache(

0 commit comments

Comments
 (0)