ci/lava: Force use of UTC timezones
authorGuilherme Gallo <guilherme.gallo@collabora.com>
Tue, 18 Apr 2023 03:53:13 +0000 (00:53 -0300)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Apr 2023 14:36:37 +0000 (14:36 +0000)
LAVA farm is giving datetime in UTC timezone, let's standardize it
locally for the script run, so datetimes coming from LAVA proxy calls
will be at the same timezone as the ones we use in structural logging
and traces.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22500>

.gitlab-ci/lava/lava_job_submitter.py

index c2b6697..39d07de 100755 (executable)
@@ -466,5 +466,11 @@ if __name__ == "__main__":
     # more buffering
     sys.stdout.reconfigure(line_buffering=True)
     sys.stderr.reconfigure(line_buffering=True)
+    # LAVA farm is giving datetime in UTC timezone, let's set it locally for the
+    # script run.
+    # Setting environ here will not affect the system time, as the os.environ
+    # lifetime follows the script one.
+    environ["TZ"] = "UTC"
+    time.tzset()
 
     fire.Fire(LAVAJobSubmitter)