canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #02543
[Merge] ~andersson123/autopkgtest-cloud:uuid-integration into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:uuid-integration into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/458950
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:uuid-integration into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/run-autopkgtest b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/run-autopkgtest
index 2584323..01f5c33 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/run-autopkgtest
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/tools/run-autopkgtest
@@ -5,6 +5,7 @@
import argparse
import json
+import uuid
import os
import sys
import urllib.parse
@@ -176,6 +177,7 @@ if __name__ == "__main__":
params["submit-time"] = datetime.strftime(
datetime.utcnow(), "%Y-%m-%d %H:%M:%S%z"
)
+ params["uuid"] = uuid.uuid1()
params = "\n" + json.dumps(params)
try:
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index c96b0ef..2a6f2fa 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -24,6 +24,7 @@ import sys
import tempfile
import time
import urllib.request
+import uuid
from urllib.error import HTTPError
import amqplib.client_0_8 as amqp
@@ -319,7 +320,7 @@ def request_matches_per_package(package, arch, release, s):
)
-def process_output_dir(dir, pkgname, code, triggers):
+def process_output_dir(dir, pkgname, code, triggers, test_uuid):
"""Post-process output directory"""
files = set(os.listdir(dir))
@@ -363,6 +364,9 @@ def process_output_dir(dir, pkgname, code, triggers):
requester = req.read()
except FileNotFoundError:
requester = None
+
+ with open(os.path.join(dir, "uuid"), "w") as uuid_f:
+ uuid_f.write(test_uuid)
# these are small and we need only these for gating and indexing
resultfiles = ["exitcode"]
@@ -374,6 +378,7 @@ def process_output_dir(dir, pkgname, code, triggers):
"testinfo.json",
"requester",
"summary",
+ "uuid",
]:
if f in files:
resultfiles.append(f)
@@ -628,6 +633,12 @@ def request(msg):
except (ValueError, IndexError):
logging.error('Received invalid request format "%s"', body)
return
+ if "uuid" not in params:
+ logging.debug("No uuid in params! Creating one...")
+ test_uuid = uuid.uuid1()
+ params["uuid"] = test_uuid
+ else:
+ test_uuid = params["uuid"]
if not re.match("[a-zA-Z0-9.+-]+$", pkgname):
logging.error(
@@ -1246,7 +1257,7 @@ def request(msg):
f.write("%s\n" % params["readable-by"])
(testpkg_version, duration, requester) = process_output_dir(
- out_dir, pkgname, code, params.get("triggers", [])
+ out_dir, pkgname, code, params.get("triggers", []), test_uuid
)
# If two tests for the same package with different triggers finish at the
@@ -1369,6 +1380,7 @@ def request(msg):
"requester": requester,
"swift_dir": swift_dir,
"triggers": triggers,
+ "uuid": test_uuid,
}
)
complete_amqp.basic_publish(
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 1110863..84db226 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -13,6 +13,7 @@ import sqlite3
import urllib.parse
import urllib.request
from datetime import datetime
+import uuid
from urllib.error import HTTPError
import amqplib.client_0_8 as amqp
@@ -336,6 +337,7 @@ class Submit:
params["submit-time"] = datetime.strftime(
datetime.utcnow(), "%Y-%m-%d %H:%M:%S%z"
)
+ params["uuid"] = uuid.uuid1()
body = "%s %s" % (package, json.dumps(params, sort_keys=True))
with amqp.Connection(
self.amqp_creds.hostname,
Follow ups