Skip to content

Commit 2e96431

Browse files
committed
Bump version to 1.27.0
2 parents 1307f03 + 34c30a9 commit 2e96431

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
CHANGELOG
22
`````````
33

4+
Version 1.27.0 -- 2022-08-03
5+
----------------------------
6+
- Modify behavior of acquire-html-dir command
7+
If a build has finished, then a lock will not be acquired (and
8+
consequently the path to the HTML directory will not be
9+
printed to stdout) until the report has finished rendering.
10+
11+
412
Version 1.26.0 -- 2022-05-18
513
----------------------------
614

lib/litani.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
TIME_FORMAT_W = "%Y-%m-%dT%H:%M:%SZ"
3434
TIME_FORMAT_MS = "%Y-%m-%dT%H:%M:%S.%fZ"
3535
VERSION_MAJOR = 1
36-
VERSION_MINOR = 26
36+
VERSION_MINOR = 27
3737
VERSION_PATCH = 0
3838
RC = False
3939

@@ -58,6 +58,22 @@ def is_expired(self):
5858

5959

6060

61+
class ReportRendering:
62+
"""This class is to mark the completion of the report rendering process"""
63+
64+
def __init__(self):
65+
self._touchfile = get_cache_dir().resolve() / ".litani-completed"
66+
67+
68+
def complete(self):
69+
self._touchfile.touch()
70+
71+
72+
def has_completed(self):
73+
return self._touchfile.exists()
74+
75+
76+
6177
class AcquisitionFailed(Exception):
6278
pass
6379

lib/litani_report.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,16 +448,22 @@ async def acquire_html_dir(args):
448448
end = datetime.datetime.now() + datetime.timedelta(seconds=args.timeout)
449449
else:
450450
end = datetime.datetime.max
451-
while True:
451+
while datetime.datetime.now() <= end:
452452
html_dir = lib.litani.get_report_dir().resolve()
453453
lockable_dir = lib.litani.LockableDirectory(html_dir)
454-
if lockable_dir.acquire():
455-
print(html_dir)
456-
sys.exit(0)
457-
if datetime.datetime.now() > end:
458-
sys.exit(1)
459-
await asyncio.sleep(1)
460-
454+
if not lockable_dir.acquire():
455+
await asyncio.sleep(1)
456+
continue
457+
with open(html_dir / "run.json") as handle:
458+
run = json.load(handle)
459+
is_completed_run = run["status"] != "in_progress"
460+
if is_completed_run and not litani.ReportRendering().has_completed():
461+
lockable_dir.release()
462+
await asyncio.sleep(1)
463+
continue
464+
print(html_dir)
465+
sys.exit(0)
466+
sys.exit(1)
461467

462468
async def print_html_dir(_):
463469
html_dir = lib.litani.get_report_dir()

lib/run_build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ async def run_build(args):
213213
with litani.atomic_write(args.out_file) as handle:
214214
print(json.dumps(run, indent=2), file=handle)
215215

216+
report_rendering = litani.ReportRendering()
217+
report_rendering.complete()
218+
216219
# Print the path to the complete report at the end of 'litani run-build'.
217220
# The same path was printed at the start of 'litani init'.
218221
if 'latest_symlink' in run_info:

0 commit comments

Comments
 (0)