Skip to content

Commit 188d894

Browse files
author
Gonchik Tsymzhitov
committed
Bitbucket: Revert back the commit 61729af and add the fix for the endPoint parameter for the method delete_branch
1 parent d8ffde7 commit 188d894

File tree

63 files changed

+1267
-534
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1267
-534
lines changed

atlassian/bamboo.py

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,15 @@ def _get_generator(
6666
yield response
6767

6868
def base_list_call(
69-
self, resource, expand, favourite, clover_enabled, max_results, label=None, start_index=0, **kwargs
69+
self,
70+
resource,
71+
expand,
72+
favourite,
73+
clover_enabled,
74+
max_results,
75+
label=None,
76+
start_index=0,
77+
**kwargs
7078
):
7179
flags = []
7280
params = {"max-results": max_results}
@@ -93,7 +101,9 @@ def base_list_call(
93101

94102
""" Projects & Plans """
95103

96-
def projects(self, expand=None, favourite=False, clover_enabled=False, max_results=25):
104+
def projects(
105+
self, expand=None, favourite=False, clover_enabled=False, max_results=25
106+
):
97107
return self.base_list_call(
98108
"project",
99109
expand=expand,
@@ -207,7 +217,9 @@ def enable_plan(self, plan_key):
207217

208218
""" Branches """
209219

210-
def search_branches(self, plan_key, include_default_branch=True, max_results=25, start=0):
220+
def search_branches(
221+
self, plan_key, include_default_branch=True, max_results=25, start=0
222+
):
211223
params = {
212224
"max-result": max_results,
213225
"start-index": start,
@@ -249,7 +261,9 @@ def get_branch_info(self, plan_key, branch_name):
249261
:param branch_name:
250262
:return:
251263
"""
252-
resource = "plan/{plan_key}/branch/{branch_name}".format(plan_key=plan_key, branch_name=branch_name)
264+
resource = "plan/{plan_key}/branch/{branch_name}".format(
265+
plan_key=plan_key, branch_name=branch_name
266+
)
253267
return self.get(self.resource_url(resource))
254268

255269
def create_branch(
@@ -272,7 +286,9 @@ def create_branch(
272286
:param cleanup_enabled: bool
273287
:return: PUT request
274288
"""
275-
resource = "plan/{plan_key}/branch/{branch_name}".format(plan_key=plan_key, branch_name=branch_name)
289+
resource = "plan/{plan_key}/branch/{branch_name}".format(
290+
plan_key=plan_key, branch_name=branch_name
291+
)
276292
params = {}
277293
if vcs_branch:
278294
params = dict(
@@ -334,7 +350,9 @@ def results(
334350
"""
335351
resource = "result"
336352
if project_key and plan_key and job_key and build_number:
337-
resource += "/{}-{}-{}/{}".format(project_key, plan_key, job_key, build_number)
353+
resource += "/{}-{}-{}/{}".format(
354+
project_key, plan_key, job_key, build_number
355+
)
338356
elif project_key and plan_key and build_number:
339357
resource += "/{}-{}/{}".format(project_key, plan_key, build_number)
340358
elif project_key and plan_key:
@@ -471,7 +489,9 @@ def plan_results(
471489
include_all_states=include_all_states,
472490
)
473491

474-
def build_result(self, build_key, expand=None, include_all_states=False, start=0, max_results=25):
492+
def build_result(
493+
self, build_key, expand=None, include_all_states=False, start=0, max_results=25
494+
):
475495
"""
476496
Returns details of a specific build result
477497
:param expand: expands build result details on request. Possible values are: artifacts, comments, labels,
@@ -496,7 +516,9 @@ def build_result(self, build_key, expand=None, include_all_states=False, start=0
496516
include_all_states=include_all_states,
497517
)
498518
except ValueError:
499-
raise ValueError('The key "{}" does not correspond to a build result'.format(build_key))
519+
raise ValueError(
520+
'The key "{}" does not correspond to a build result'.format(build_key)
521+
)
500522

501523
def build_latest_result(self, plan_key, expand=None, include_all_states=False):
502524
"""
@@ -519,7 +541,11 @@ def build_latest_result(self, plan_key, expand=None, include_all_states=False):
519541
include_all_states=include_all_states,
520542
)
521543
except ValueError:
522-
raise ValueError('The key "{}" does not correspond to the latest build result'.format(plan_key))
544+
raise ValueError(
545+
'The key "{}" does not correspond to the latest build result'.format(
546+
plan_key
547+
)
548+
)
523549

524550
def delete_build_result(self, build_key):
525551
"""
@@ -531,9 +557,18 @@ def delete_build_result(self, build_key):
531557
plan_key = "{}-{}".format(build_key[0], build_key[1])
532558
build_number = build_key[2]
533559
params = {"buildKey": plan_key, "buildNumber": build_number}
534-
return self.post(custom_resource, params=params, headers=self.form_token_headers)
560+
return self.post(
561+
custom_resource, params=params, headers=self.form_token_headers
562+
)
535563

536-
def execute_build(self, plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables):
564+
def execute_build(
565+
self,
566+
plan_key,
567+
stage=None,
568+
execute_all_stages=True,
569+
custom_revision=None,
570+
**bamboo_variables
571+
):
537572
"""
538573
Fire build execution for specified plan.
539574
!IMPORTANT! NOTE: for some reason, this method always execute all stages
@@ -569,7 +604,9 @@ def stop_build(self, plan_key):
569604

570605
""" Comments & Labels """
571606

572-
def comments(self, project_key, plan_key, build_number, start_index=0, max_results=25):
607+
def comments(
608+
self, project_key, plan_key, build_number, start_index=0, max_results=25
609+
):
573610
resource = "result/{}-{}-{}/comment".format(project_key, plan_key, build_number)
574611
params = {"start-index": start_index, "max-results": max_results}
575612
return self.get(self.resource_url(resource), params=params)
@@ -582,7 +619,9 @@ def create_comment(self, project_key, plan_key, build_number, comment, author=No
582619
}
583620
return self.post(self.resource_url(resource), data=comment_data)
584621

585-
def labels(self, project_key, plan_key, build_number, start_index=0, max_results=25):
622+
def labels(
623+
self, project_key, plan_key, build_number, start_index=0, max_results=25
624+
):
586625
resource = "result/{}-{}-{}/label".format(project_key, plan_key, build_number)
587626
params = {"start-index": start_index, "max-results": max_results}
588627
return self.get(self.resource_url(resource), params=params)
@@ -592,7 +631,9 @@ def create_label(self, project_key, plan_key, build_number, label):
592631
return self.post(self.resource_url(resource), data={"name": label})
593632

594633
def delete_label(self, project_key, plan_key, build_number, label):
595-
resource = "result/{}-{}-{}/label/{}".format(project_key, plan_key, build_number, label)
634+
resource = "result/{}-{}-{}/label/{}".format(
635+
project_key, plan_key, build_number, label
636+
)
596637
return self.delete(self.resource_url(resource))
597638

598639
def get_projects(self):
@@ -626,7 +667,9 @@ def deployment_project(self, project_id):
626667
return self.get(self.resource_url(resource))
627668

628669
def deployment_environment_results(self, env_id, expand=None, max_results=25):
629-
resource = "deploy/environment/{environmentId}/results".format(environmentId=env_id)
670+
resource = "deploy/environment/{environmentId}/results".format(
671+
environmentId=env_id
672+
)
630673
params = {"max-result": max_results, "start-index": 0}
631674
size = 1
632675
if expand:
@@ -643,7 +686,11 @@ def deployment_dashboard(self, project_id=None):
643686
Returns the current status of each deployment environment
644687
If no project id is provided, returns all projects.
645688
"""
646-
resource = "deploy/dashboard/{}".format(project_id) if project_id else "deploy/dashboard"
689+
resource = (
690+
"deploy/dashboard/{}".format(project_id)
691+
if project_id
692+
else "deploy/dashboard"
693+
)
647694
return self.get(self.resource_url(resource))
648695

649696
""" Users & Groups """

0 commit comments

Comments
 (0)