Adding reference of CROS_TH version for proper labeling

CrOS tree hugger is ARC CQ which has a different cros version label.
To ensure that the DUT gets labeled with the right prefix CROS_TH label by
provisioning, adding the prefix reference for the new label in provision and
host code. The actual test changes are coming in a follow up CL.

This change is to ensure that I am not missing any other references.

TEST=None
BUG=b:26895109

Change-Id: I491b72d9544d5398ac67a171838e7f0b1caf12e3
Reviewed-on: https://chromium-review.googlesource.com/528628
Commit-Ready: Rohit Makasana <rohitbm@chromium.org>
Tested-by: Rohit Makasana <rohitbm@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/cros/provision.py b/server/cros/provision.py
index 70de149..ee389ed 100644
--- a/server/cros/provision.py
+++ b/server/cros/provision.py
@@ -15,6 +15,7 @@
 
 ### Constants for label prefixes
 CROS_VERSION_PREFIX = Key.CROS_VERSION
+CROS_TH_VERSION_PREFIX = Key.CROS_TH_VERSION
 ANDROID_BUILD_VERSION_PREFIX = Key.ANDROID_BUILD_VERSION
 TESTBED_BUILD_VERSION_PREFIX = Key.TESTBED_VERSION
 FW_RW_VERSION_PREFIX = Key.FIRMWARE_RW_VERSION
@@ -22,6 +23,7 @@
 
 _ANDROID_BUILD_REGEX = r'.+/.+/P?([0-9]+|LATEST)'
 _ANDROID_TESTBED_BUILD_REGEX = _ANDROID_BUILD_REGEX + '(,|(#[0-9]+))'
+_CROS_TH_BUILD_REGEX = r'.+-release/.+;.+/.+/P?[0-9]+$'
 
 # Special label to skip provision and run reset instead.
 SKIP_PROVISION = 'skip_provision'
@@ -62,6 +64,9 @@
     Known version label prefixes are:
       * `CROS_VERSION_PREFIX` for Chrome OS version strings.
         These images have names like `cave-release/R57-9030.0.0`.
+      * `CROS_TH_VERSION_PREFIX` for Chrome OS ARC TH version strings.
+        These images have names like
+        `cyan-release/R60-9517.0.0;git_nyc-arc/cheets_x86-user/3512523`.
       * `ANDROID_BUILD_VERSION_PREFIX` for Android build versions
         These images have names like
         `git_mnc-release/shamu-userdebug/2457013`.
@@ -79,6 +84,8 @@
         return TESTBED_BUILD_VERSION_PREFIX
     elif re.match(_ANDROID_BUILD_REGEX, image, re.I):
         return ANDROID_BUILD_VERSION_PREFIX
+    elif re.match(_CROS_TH_BUILD_REGEX, image, re.I):
+        return CROS_TH_VERSION_PREFIX
     else:
         return CROS_VERSION_PREFIX
 
@@ -304,6 +311,8 @@
                               'disable_before_iteration_sysinfo': True,
                               'disable_after_test_sysinfo': True,
                               'disable_after_iteration_sysinfo': True}),
+        CROS_TH_VERSION_PREFIX : actionables.TestActionable(
+                'provision_CheetsUpdate'),
         FW_RO_VERSION_PREFIX: actionables.TestActionable(
                 'provision_FirmwareUpdate'),
         FW_RW_VERSION_PREFIX: actionables.TestActionable(
diff --git a/server/hosts/host_info.py b/server/hosts/host_info.py
index bb4db09..8112f00 100644
--- a/server/hosts/host_info.py
+++ b/server/hosts/host_info.py
@@ -39,6 +39,7 @@
 
     _VERSION_LABELS = (
             provision.CROS_VERSION_PREFIX,
+            provision.CROS_TH_VERSION_PREFIX,
             provision.ANDROID_BUILD_VERSION_PREFIX,
             provision.TESTBED_BUILD_VERSION_PREFIX,
     )
diff --git a/utils/labellib.py b/utils/labellib.py
index 02f367e..afd08a6 100644
--- a/utils/labellib.py
+++ b/utils/labellib.py
@@ -25,6 +25,7 @@
 class Key(object):
     """Enum for keyval label keys."""
     CROS_VERSION = 'cros-version'
+    CROS_TH_VERSION = 'cros-th-version'
     ANDROID_BUILD_VERSION = 'ab-version'
     TESTBED_VERSION = 'testbed-version'
     FIRMWARE_RW_VERSION = 'fwrw-version'
@@ -172,4 +173,4 @@
         return '{group}/{milestone}-{version}-{rc}'.format(
                 **cros_version._asdict())
     else:
-        return '{group}/{milestone}-{version}'.format(**cros_version._asdict())
\ No newline at end of file
+        return '{group}/{milestone}-{version}'.format(**cros_version._asdict())