Skip to content

Commit 223489b

Browse files
authored
Merge pull request #25 from GilbN/master
Add option for multiple warning texts
2 parents 5a6c8ab + 6ca76d5 commit 223489b

File tree

2 files changed

+62
-19
lines changed

2 files changed

+62
-19
lines changed

ci/ci.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,16 @@ def __init__(self) -> None:
104104
aws_secret_access_key=self.s3_secret)
105105

106106
def run(self,tags: list) -> None:
107-
"""Will iterate over all the tags running container_test() on each tag multithreaded.
107+
"""Will iterate over all the tags running container_test() on each tag, multithreaded.
108+
109+
Also does a pull of the linuxserver/tester:latest image before running container_test.
108110
109111
Args:
110112
`tags` (list): All the tags we will test on the image.
111113
112114
"""
115+
self.logger.info("Pulling ghcr.io/linuxserver/tester:latest")
116+
self.client.images.pull(repository="ghcr.io/linuxserver/tester", tag="latest") # Pulls latest tester image.
113117
thread_pool = ThreadPool(processes=10)
114118
thread_pool.map(self.container_test,tags)
115119
display = Display(size=(1920, 1080)) # Setup an x virtual frame buffer (Xvfb) that Selenium can use during the tests.
@@ -130,6 +134,7 @@ def container_test(self, tag: str) -> None:
130134
2. Export the build version from the Container object.
131135
3. Export the package info from the Container object.
132136
4. Take a screenshot for the report.
137+
5. Add report information to report.json.
133138
"""
134139
def _endtest(self: CI, container:Container, tag:str, build_version:str, packages:str, test_success: bool):
135140
"""End the test with as much info as we have and append to the report.
@@ -143,16 +148,23 @@ def _endtest(self: CI, container:Container, tag:str, build_version:str, packages
143148
"""
144149
logblob = container.logs().decode('utf-8')
145150
container.remove(force='true')
151+
warning_texts = {
152+
"dotnet": "May be a .NET app. Service might not start on ARM32 with QEMU",
153+
"uwsgi": "This image uses uWSGI and might not start on ARM/QEMU"
154+
}
146155
# Add the info to the report
147156
self.report_containers[tag] = {
148157
'logs': logblob,
149158
'sysinfo': packages,
150-
'dotnet': bool("icu-libs" in packages),
159+
'warnings': {
160+
'dotnet': warning_texts["dotnet"] if "icu-libs" in packages and "arm32" in tag else "",
161+
'uwsgi': warning_texts["uwsgi"] if "uwsgi" in packages and "arm" in tag else ""
162+
},
151163
'build_version': build_version,
152164
'test_results': self.tag_report_tests[tag]['test'],
153-
'test_success': test_success
165+
'test_success': test_success,
154166
}
155-
167+
self.report_containers[tag]["has_warnings"] = any(warning[1] for warning in self.report_containers[tag]["warnings"].items())
156168
# Name the thread for easier debugging.
157169
if "amd" in tag or "arm" in tag:
158170
current_thread().name = f"{tag[:5].upper()}Thread"

ci/template.html

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
color: rgba(218, 59, 138);
5555
}
5656

57+
.summary {
58+
color: rgba(218, 59, 138);
59+
}
60+
61+
.summary:hover {
62+
color: rgb(188, 52, 120);
63+
}
64+
5765
.styled-table {
5866
border: solid 1px rgb(255 255 255 / 10%);
5967
}
@@ -92,7 +100,7 @@
92100
color: rgba(218, 59, 138);
93101
}
94102
}
95-
.dotnet-note {
103+
.warning-note {
96104
color: #96a2b4;
97105
}
98106

@@ -102,7 +110,7 @@
102110
color: #738694;
103111
}
104112

105-
.dotnet-note {
113+
.warning-note {
106114
color: #738694;
107115
}
108116

@@ -291,6 +299,13 @@
291299
padding: 0 30px;
292300
}
293301

302+
.summary {
303+
font-weight: bold;
304+
margin-block-start: 1em;
305+
margin-inline-start: 0px;
306+
margin-inline-end: 0px;
307+
}
308+
294309
section img {
295310
width: calc(100% + 60px);
296311
height: auto;
@@ -327,7 +342,7 @@
327342
/*Mobile*/
328343
section h3,
329344
section details,
330-
.dotnet-notice,
345+
.warning-notice,
331346
.table-container {
332347
padding: 0 5px;
333348
}
@@ -374,9 +389,14 @@
374389
margin-left: 5px;
375390
}
376391

392+
.fa-exclamation-triangle {
393+
color: darkorange;
394+
}
395+
377396
.summary-container {
378397
min-height: 100px;
379398
height: 300px;
399+
margin-top: 0.5em;
380400
overflow: auto;
381401
resize: vertical;
382402
}
@@ -412,25 +432,31 @@
412432
color: #f44336;
413433
}
414434

415-
.dotnet-notice {
435+
.warning-notice {
416436
display: inline-flex;
417437
}
418438

419-
.dotnet-note {
439+
.warning-note {
420440
padding-left: .5rem;
441+
padding-top: 0.5em;
421442
font-weight: normal;
422443
}
423444

424-
div.dotnet-notice > p {
445+
div.warning-notice > p {
425446
margin-bottom: 0;
426447
}
427448

428-
.dotnet-heading {
449+
.warning-summary {
429450
padding-right:5px;
430451
padding-bottom:0;
452+
margin-block-start: 1em;
431453
color: darkorange;
432454
font-weight: bold;
433455
}
456+
457+
.warning-summary:hover {
458+
color: #ff8c00db;
459+
}
434460
</style>
435461

436462
</head>
@@ -459,22 +485,27 @@ <h2 class="section-header-h2"> {{ image }}:{{ tag }} </h2>
459485
</div>
460486
{% endif %}
461487
<h3 class="build-version">Build Version: {{ report_containers[tag]["build_version"] }}</h3>
462-
<h3>Container Logs</h3>
463488
<details>
464-
<summary>Expand</summary>
489+
<summary class="summary">Container Logs</summary>
465490
<div class="summary-container"><pre><code>{{ report_containers[tag]["logs"] }}</code>
466491
</pre></div>
467492
</details>
468-
<h3>Package info</h3>
469493
<details>
470-
<summary>Expand</summary>
494+
<summary class="summary">Package info</summary>
471495
<div class="summary-container"><pre><code>{{ report_containers[tag]["sysinfo"] }}</code>
472496
</pre></div>
473497
</details>
474-
{% if 'arm32' in tag and report_containers[tag]["dotnet"] == true %}
475-
<div class="dotnet-notice">
476-
<p class="dotnet-heading">Warning:<span class="dotnet-note">May be a .NET app. Service might not start on ARM32 with QEMU</span></p>
477-
</div>
498+
{% if report_containers[tag]["has_warnings"]%}
499+
<details open>
500+
<summary class="warning-summary">Warnings</summary>
501+
{% for warning in report_containers[tag]["warnings"] %}
502+
{% if report_containers[tag]["warnings"][warning] %}
503+
<div class="warning-notice">
504+
<code class="warning-note"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {{ report_containers[tag]["warnings"][warning] }}</code>
505+
</div>
506+
{% endif %}
507+
{% endfor %}
508+
</details>
478509
{% endif %}
479510
<div class="table-container">
480511
<table class="styled-table">

0 commit comments

Comments
 (0)