aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/utils.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-03-26 09:12:36 +0200
committerTibor Frank <tifrank@cisco.com>2018-03-26 09:12:36 +0200
commitaaa58d348c375f80e65dfdf62a679dd0cbac4411 (patch)
tree95961d5d6ae7f701296ae8c89ea6df6b37b83a7e /resources/tools/presentation/utils.py
parent806d2bf874f34d80e92c700652f226359402b1e8 (diff)
Add lastCompletedBuild option to the spec
Change-Id: I4432e626a7bc81be2cede56da6a3660450f09c01 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/utils.py')
-rw-r--r--resources/tools/presentation/utils.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/resources/tools/presentation/utils.py b/resources/tools/presentation/utils.py
index 966d7f558b..154b6e9b23 100644
--- a/resources/tools/presentation/utils.py
+++ b/resources/tools/presentation/utils.py
@@ -172,15 +172,35 @@ def execute_command(cmd):
return proc.returncode, stdout, stderr
-def get_last_build_number(jenkins_url, job_name):
+def get_last_successful_build_number(jenkins_url, job_name):
+ """Get the number of the last successful build of the given job.
+
+ :param jenkins_url: Jenkins URL.
+ :param job_name: Job name.
+ :type jenkins_url: str
+ :type job_name: str
+ :returns: The build number as a string.
+ :rtype: str
"""
- :param jenkins_url:
- :param job_name:
- :return:
+ url = "{}/{}/lastSuccessfulBuild/buildNumber".format(jenkins_url, job_name)
+ cmd = "wget -qO- {url}".format(url=url)
+
+ return execute_command(cmd)
+
+
+def get_last_completed_build_number(jenkins_url, job_name):
+ """Get the number of the last completed build of the given job.
+
+ :param jenkins_url: Jenkins URL.
+ :param job_name: Job name.
+ :type jenkins_url: str
+ :type job_name: str
+ :returns: The build number as a string.
+ :rtype: str
"""
- url = "{}/{}/lastSuccessfulBuild/buildNumber".format(jenkins_url, job_name)
+ url = "{}/{}/lastCompletedBuild/buildNumber".format(jenkins_url, job_name)
cmd = "wget -qO- {url}".format(url=url)
return execute_command(cmd)