diff --git a/jenkins/__init__.py b/jenkins/__init__.py index 5c214e9..235dd05 100755 --- a/jenkins/__init__.py +++ b/jenkins/__init__.py @@ -1149,7 +1149,7 @@ class Jenkins(object): executor_number = executor['number'] build_number = executable['number'] url = executable['url'] - m = re.match(r'/job/([^/]+)/.*', urlparse(url).path) + m = re.search(r'/job/([^/]+)/.*', urlparse(url).path) job_name = m.group(1) builds.append({'name': job_name, 'number': build_number, diff --git a/tests/test_build.py b/tests/test_build.py index c5ce49f..497ae30 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -259,7 +259,7 @@ class JenkinsListRunningBuildsTest(JenkinsTestBase): "number": 1, "result": None, "timestamp": 1442262342729, - "url": "https://localhost/job/test/1/", + "url": self.make_url('job/test/1/'), "builtOn": "", "changeSet": { "items": [], @@ -293,7 +293,7 @@ class JenkinsListRunningBuildsTest(JenkinsTestBase): 'number': 1, 'node': '(master)', 'executor': 1, - 'url': 'https://localhost/job/test/1/'}], builds) + 'url': self.make_url('job/test/1/')}], builds) @patch.object(jenkins.Jenkins, 'get_node_info') @patch.object(jenkins.Jenkins, 'get_nodes') @@ -338,7 +338,7 @@ class JenkinsListRunningBuildsTest(JenkinsTestBase): "number": 15, "result": None, "timestamp": 1442262342729, - "url": "https://localhost/job/test/15/", + "url": self.make_url("job/test/15/"), "builtOn": "", "changeSet": { "items": [], @@ -372,7 +372,7 @@ class JenkinsListRunningBuildsTest(JenkinsTestBase): 'number': 15, 'node': 'foo-slave', 'executor': 0, - 'url': 'https://localhost/job/test/15/'}], builds) + 'url': self.make_url('job/test/15/')}], builds) @patch.object(jenkins.Jenkins, 'get_node_info') @patch.object(jenkins.Jenkins, 'get_nodes')