← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:all-proposed-patch into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:all-proposed-patch 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/459627
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:all-proposed-patch into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index ea31096..dda045e 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -79,6 +79,8 @@ ARCH_RELEASE_ALLOW_MAPPING = {
 
 FAIL_CODES = (4, 6, 12, 14, 20)
 
+VARS_FOR_ENV = ["all-proposed"]
+
 # In the case of a tmpfail, look for these strings in the log and if they're
 # found, consider this a real failure instead. This is useful if the test
 # breaks the testbed so much that autopkgtest can't report a failure properly -
@@ -319,7 +321,7 @@ def request_matches_per_package(package, arch, release, s):
     )
 
 
-def process_output_dir(dir, pkgname, code, triggers, all_proposed):
+def process_output_dir(dir, pkgname, code, triggers, envs):
     """Post-process output directory"""
 
     files = set(os.listdir(dir))
@@ -350,11 +352,14 @@ def process_output_dir(dir, pkgname, code, triggers, all_proposed):
             files.add("testinfo.json")
 
     # add all-proposed to testinfo.json if test was triggered with all-proposed=1
-    if all_proposed:
+    if envs != "":
+        keys = envs.split(",")
         d = {}
         with open(os.path.join(dir, "testinfo.json"), "r") as testinfo:
             d = json.load(testinfo)
-        d["all-proposed"] = 1
+        for k in keys:
+            key, value = k.split("=")
+            d[key] = value
         with open(os.path.join(dir, "testinfo.json"), "w") as testinfo:
             json.dump(d, testinfo, indent=True)
 
@@ -1243,12 +1248,18 @@ def request(msg):
                 else:
                     f.write("%s\n" % params["readable-by"])
 
+        envs = []
+        for env_var in VARS_FOR_ENV:
+            if params.get(env_var, None) is not None:
+                envs.append("%s=%s" % (env_var, params[env_var]))
+                
+
         (testpkg_version, duration, requester) = process_output_dir(
             out_dir,
             pkgname,
             code,
             params.get("triggers", []),
-            True if params.get("all-proposed", 0) == 1 else False,
+            ",".join(envs) if len(envs) != 0 else "",
         )
 
         # If two tests for the same package with different triggers finish at the
@@ -1371,7 +1382,7 @@ def request(msg):
             "requester": requester,
             "swift_dir": swift_dir,
             "triggers": triggers,
-            "all-proposed": 1 if "all-proposed" in params else 0,
+            "env": ",".join(envs) if len(envs) != 0 else "",
         }
     )
     complete_amqp.basic_publish(
diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
index 9a86a66..c36ac7e 100755
--- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi
+++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi
@@ -329,12 +329,11 @@ def package_release_arch(package, release, arch, _=None):
                 triggers,
                 env,
                 human_date(row[0]),
-                human_sec(row[3]),
+                human_sec(int(row[3])),
                 requester,
                 code,
                 url,
                 show_retry,
-                "&all-proposed=1" if "all-proposed=1" in env else "",
             )
         )
 
diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-results.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-results.html
index 6ae5ab8..3d6b680 100644
--- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-results.html
+++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-results.html
@@ -20,14 +20,14 @@
       <td>{{row[1]}}</td>
       <td>{{row[2]}}</td>
       <td>{{row[3]}}</td>
+      <td class="{{row[4]}}">{{row[4]}}</td>
       <td>
-        {% if row[4] != "-" %}
+        {% if row[5] != "-" %}
           <a href="https://launchpad.net/~{{row[4]}}";>{{row[4]}}</a>
         {% else %}
-          {{row[4]}}
+          {{row[5]}}
         {% endif %}
       </td>
-      <td class="{{row[5]}}">{{row[5]}}</td>
       <td class="nowrap">
         <a href="{{row[7]}}/log.gz">log</a> &emsp;
         <a href="{{row[7]}}/artifacts.tar.gz">artifacts</a> &emsp;

Follow ups