File tree Expand file tree Collapse file tree 6 files changed +33
-0
lines changed Expand file tree Collapse file tree 6 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ services:
2424 - module : shellexec
2525 prepare :
2626 - python util/pre_run/environment_checker.py
27+ - python util/pre_run/check_for_updates.py
2728 - python util/pre_run/git_client_check.py
2829 - python util/data_preparation/bitbucket_prepare_data.py
2930 shutdown :
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ services:
3838 - module : shellexec
3939 prepare :
4040 - python util/pre_run/environment_checker.py
41+ - python util/pre_run/check_for_updates.py
4142 - python util/data_preparation/confluence_prepare_data.py
4243 shutdown :
4344 - python util/post_run/jmeter_post_check.py
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ services:
3636 - module : shellexec
3737 prepare :
3838 - python util/pre_run/environment_checker.py
39+ - python util/pre_run/check_for_updates.py
3940 - python util/data_preparation/crowd_prepare_data.py
4041 - python util/data_preparation/crowd_sync_check.py
4142 shutdown :
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ services:
4040 - module : shellexec
4141 prepare :
4242 - python util/pre_run/environment_checker.py
43+ - python util/pre_run/check_for_updates.py
4344 - python util/data_preparation/jira_prepare_data.py
4445 shutdown :
4546 - python util/post_run/jmeter_post_check.py
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ services:
4949 - module : shellexec
5050 prepare :
5151 - python util/pre_run/environment_checker.py
52+ - python util/pre_run/check_for_updates.py
5253 - python util/data_preparation/jsm_prepare_data.py
5354 shutdown :
5455 - python util/post_run/jmeter_post_check.py
Original file line number Diff line number Diff line change 1+ import requests
2+ from packaging import version
3+
4+ from util .conf import TOOLKIT_VERSION
5+
6+ CONF_URL = "https://raw.githubusercontent.com/atlassian/dc-app-performance-toolkit/master/app/util/conf.py"
7+ VERSION_STR = "TOOLKIT_VERSION"
8+
9+ r = requests .get (CONF_URL )
10+
11+ if not r .ok :
12+ print (f"Warning: DCAPT check for updates failed.\n URL: { r .url } . Status code: { r .status_code } . Reason: { r .reason } " )
13+ exit (0 )
14+
15+ conf = r .text .splitlines ()
16+ version_line = next ((line for line in conf if VERSION_STR in line ))
17+ latest_version_str = version_line .split ('=' )[1 ].replace ("'" , "" ).replace ('"' , "" ).strip ()
18+
19+ latest_version = version .parse (latest_version_str )
20+ current_version = version .parse (TOOLKIT_VERSION )
21+
22+ if current_version < latest_version :
23+ print (f"Warning: DCAPT version { TOOLKIT_VERSION } is outdated. "
24+ f"Consider upgrade to the latest version: { latest_version } ." )
25+ elif current_version == latest_version :
26+ print (f"Info: DCAPT version { TOOLKIT_VERSION } is latest." )
27+ else :
28+ print (f"Info: DCAPT version { TOOLKIT_VERSION } is ahead of the latest production version: { latest_version } ." )
You can’t perform that action at this time.
0 commit comments