From f3ef283dcf2d5de67d6163e700b5de5b19ef6959 Mon Sep 17 00:00:00 2001 From: Keshav Priyadarshi Date: Thu, 22 May 2025 01:27:04 +0530 Subject: [PATCH 1/5] Staging migrations Signed-off-by: Keshav Priyadarshi --- .../0092_pipelineschedule_pipelinerun.py | 17 +---------- ...0093_pipelineschedule_execution_timeout.py | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 vulnerabilities/migrations/0093_pipelineschedule_execution_timeout.py diff --git a/vulnerabilities/migrations/0092_pipelineschedule_pipelinerun.py b/vulnerabilities/migrations/0092_pipelineschedule_pipelinerun.py index 852198416..e029596d8 100644 --- a/vulnerabilities/migrations/0092_pipelineschedule_pipelinerun.py +++ b/vulnerabilities/migrations/0092_pipelineschedule_pipelinerun.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.20 on 2025-05-21 19:32 +# Generated by Django 4.2.20 on 2025-05-12 17:04 import django.core.validators from django.db import migrations, models @@ -65,21 +65,6 @@ class Migration(migrations.Migration): unique=True, ), ), - ( - "execution_timeout", - models.PositiveSmallIntegerField( - default=24, - help_text="Number hours before pipeline execution is forcefully terminated.", - validators=[ - django.core.validators.MinValueValidator( - 1, message="Pipeline timeout must be at least 1 hour." - ), - django.core.validators.MaxValueValidator( - 72, message="Pipeline timeout must be at most 72 hours." - ), - ], - ), - ), ("created_date", models.DateTimeField(auto_now_add=True, db_index=True)), ], options={ diff --git a/vulnerabilities/migrations/0093_pipelineschedule_execution_timeout.py b/vulnerabilities/migrations/0093_pipelineschedule_execution_timeout.py new file mode 100644 index 000000000..8c8d1b59a --- /dev/null +++ b/vulnerabilities/migrations/0093_pipelineschedule_execution_timeout.py @@ -0,0 +1,30 @@ +# Generated by Django 4.2.20 on 2025-05-21 19:56 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("vulnerabilities", "0092_pipelineschedule_pipelinerun"), + ] + + operations = [ + migrations.AddField( + model_name="pipelineschedule", + name="execution_timeout", + field=models.PositiveSmallIntegerField( + default=24, + help_text="Number hours before pipeline execution is forcefully terminated.", + validators=[ + django.core.validators.MinValueValidator( + 1, message="Pipeline timeout must be at least 1 hour." + ), + django.core.validators.MaxValueValidator( + 72, message="Pipeline timeout must be at most 72 hours." + ), + ], + ), + ), + ] From 9578815257704c0d30395305a6bc3f393dbb44b8 Mon Sep 17 00:00:00 2001 From: Keshav Priyadarshi Date: Thu, 22 May 2025 15:55:19 +0530 Subject: [PATCH 2/5] Show timezone in logs and stats Signed-off-by: Keshav Priyadarshi --- vulnerabilities/pipelines/__init__.py | 2 +- .../templates/pipeline_run_details.html | 18 +++++++++++++++--- .../templates/pipeline_run_list.html | 4 ++-- .../templates/pipeline_schedule_list.html | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/vulnerabilities/pipelines/__init__.py b/vulnerabilities/pipelines/__init__.py index da200db48..64fa2608e 100644 --- a/vulnerabilities/pipelines/__init__.py +++ b/vulnerabilities/pipelines/__init__.py @@ -121,7 +121,7 @@ def execute(self): def log(self, message, level=logging.INFO): """Log the given `message` to the current module logger and execution_log.""" now_local = datetime.now(timezone.utc).astimezone() - timestamp = now_local.strftime("%Y-%m-%d %H:%M:%S.%f")[:-3] + timestamp = now_local.strftime("%Y-%m-%d %T.%f %Z") message = f"{timestamp} {message}" module_logger.log(level, message) self.append_to_log(message) diff --git a/vulnerabilities/templates/pipeline_run_details.html b/vulnerabilities/templates/pipeline_run_details.html index 2953266da..83f971be4 100644 --- a/vulnerabilities/templates/pipeline_run_details.html +++ b/vulnerabilities/templates/pipeline_run_details.html @@ -77,15 +77,27 @@

{{ pipeline_name }} Run Log

Start

-

{{ run.run_start_date|default:"N/A" }}

+

+ {% if run.run_start_date %} + {{ run.run_start_date|date:"Y-m-d h:i a T" }} + {% else %} + N/A + {% endif %} +

End

-

{{ run.run_end_date|default_if_none:"N/A" }}

+

+ {% if run.run_end_date %} + {{ run.run_end_date|date:"Y-m-d h:i a T" }} + {% else %} + N/A + {% endif %} +

Created

-

{{ run.created_date }}

+

{{ run.created_date|date:"Y-m-d h:i a T" }}

Version

diff --git a/vulnerabilities/templates/pipeline_run_list.html b/vulnerabilities/templates/pipeline_run_list.html index ef87e986a..21c8007d0 100644 --- a/vulnerabilities/templates/pipeline_run_list.html +++ b/vulnerabilities/templates/pipeline_run_list.html @@ -77,14 +77,14 @@

{{ pipeline_name }} Runs

{% if run.run_start_date %} - {{ run.run_start_date|date:"Y-m-d H:i" }} + {{ run.run_start_date|date:"Y-m-d h:i a T" }} {% else %} N/A {% endif %}
{% if run.run_end_date %} - {{ run.run_end_date|date:"Y-m-d H:i" }} + {{ run.run_end_date|date:"Y-m-d h:i a T" }} {% else %} N/A {% endif %} diff --git a/vulnerabilities/templates/pipeline_schedule_list.html b/vulnerabilities/templates/pipeline_schedule_list.html index 6af521be2..12d117117 100644 --- a/vulnerabilities/templates/pipeline_schedule_list.html +++ b/vulnerabilities/templates/pipeline_schedule_list.html @@ -81,7 +81,7 @@

Pipeline Schedule

{% if schedule.latest_run_date %} - {{ schedule.latest_run_date|date:"Y-m-d H:i" }} + {{ schedule.latest_run_date|date:"Y-m-d h:i a T" }} {% else %} N/A {% endif %} From e0537cea51de3f48f420c601a2c82ac1106c6c9e Mon Sep 17 00:00:00 2001 From: Keshav Priyadarshi Date: Thu, 22 May 2025 22:17:13 +0530 Subject: [PATCH 3/5] Add clientside pagination for bigger log snippets Signed-off-by: Keshav Priyadarshi --- .../templates/pipeline_run_details.html | 62 +++++++++++++++++-- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/vulnerabilities/templates/pipeline_run_details.html b/vulnerabilities/templates/pipeline_run_details.html index 83f971be4..28b3d7c9b 100644 --- a/vulnerabilities/templates/pipeline_run_details.html +++ b/vulnerabilities/templates/pipeline_run_details.html @@ -143,20 +143,37 @@

Run Error

Log Output

- -
{{ run.log }}
+ +

+                    
+                
+ +
+ + Snippet 1 + +
+ {% endif %} - Back to All - Runs + + Back to AllRuns +
{% endblock %} @@ -167,9 +184,44 @@

Log Output

+ + + -