7777TESTGEN_PULL_TIMEOUT = 5
7878TESTGEN_PULL_RETRIES = 3
7979TESTGEN_DEFAULT_PORT = 8501
80+ TESTGEN_LATEST_VERSIONS_URL = "https://dk-support-external.s3.us-east-1.amazonaws.com/testgen-observability/testgen-latest-versions.json"
8081
8182MIXPANEL_TOKEN = "4eff51580bc1685b8ffe79ffb22d2704"
8283MIXPANEL_URL = "https://api.mixpanel.com"
@@ -1645,6 +1646,7 @@ def pre_execute(self, action, args):
16451646
16461647 CONSOLE .space ()
16471648
1649+ contents = action .docker_compose_file_path .read_text ()
16481650 if not args .skip_verify :
16491651 try :
16501652 output = action .run_cmd (
@@ -1658,9 +1660,20 @@ def pre_execute(self, action, args):
16581660 "--help" ,
16591661 capture_text = True ,
16601662 )
1661- match = re .search (r"This version:(.*)\s+Latest version:(.*)\s" , output )
1662- current_version = match .group (1 )
1663- latest_version = match .group (2 )
1663+ version_match = re .search (r"TestGen\s([0-9.]*)" , output )
1664+ current_version = version_match .group (1 )
1665+
1666+ image_match = re .search (r"image:\s*(datakitchen.+):.+\n" , contents )
1667+ docker_image = image_match .group (1 )
1668+ latest_version = "unknown"
1669+
1670+ ssl_context = ssl .create_default_context ()
1671+ ssl_context .check_hostname = False
1672+ ssl_context .verify_mode = ssl .CERT_NONE
1673+ resp = urllib .request .urlopen (TESTGEN_LATEST_VERSIONS_URL , timeout = 3 , context = ssl_context )
1674+ if resp .code == 200 :
1675+ json_data = json .loads (resp .read ().decode ('utf-8' ))
1676+ latest_version = json_data .get ("docker" , {}).get (docker_image )
16641677 except Exception :
16651678 CONSOLE .msg ("Current version: unknown" )
16661679 CONSOLE .msg ("Latest version: unknown" )
@@ -1674,7 +1687,6 @@ def pre_execute(self, action, args):
16741687 else :
16751688 CONSOLE .msg ("Application is already up-to-date." )
16761689
1677- contents = action .docker_compose_file_path .read_text ()
16781690 if args .send_analytics_data :
16791691 self .update_analytics = "TG_INSTANCE_ID" not in contents
16801692 else :
0 commit comments