Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
run-docker:

runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
python-version: ['3.4', '3.5', '3.6', '3.7', '3.8']
python-version: ['3.4', '3.5', '3.6', '3.7', '3.8', '3.9', '-dev']

steps:
- uses: actions/checkout@v2
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile.qa
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

ARG PYTHON_VERSION

RUN \
apt update && \
apt-get install -y make gcc-5 libkrb5-dev python$PYTHON_VERSION python3-pip && \
apt-get install -y make gcc-8 libkrb5-dev python$PYTHON_VERSION python3-pip && \
apt-get clean

WORKDIR /atlassian-python-api
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ setup-dev:

qa: tox

tox: export PYTHONDONTWRITEBYTECODE := 1

tox:
tox

Expand Down
79 changes: 16 additions & 63 deletions atlassian/bamboo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,7 @@ def _get_generator(
yield response

def base_list_call(
self,
resource,
expand,
favourite,
clover_enabled,
max_results,
label=None,
start_index=0,
**kwargs
self, resource, expand, favourite, clover_enabled, max_results, label=None, start_index=0, **kwargs
):
flags = []
params = {"max-results": max_results}
Expand All @@ -101,9 +93,7 @@ def base_list_call(

""" Projects & Plans """

def projects(
self, expand=None, favourite=False, clover_enabled=False, max_results=25
):
def projects(self, expand=None, favourite=False, clover_enabled=False, max_results=25):
return self.base_list_call(
"project",
expand=expand,
Expand Down Expand Up @@ -217,9 +207,7 @@ def enable_plan(self, plan_key):

""" Branches """

def search_branches(
self, plan_key, include_default_branch=True, max_results=25, start=0
):
def search_branches(self, plan_key, include_default_branch=True, max_results=25, start=0):
params = {
"max-result": max_results,
"start-index": start,
Expand Down Expand Up @@ -261,9 +249,7 @@ def get_branch_info(self, plan_key, branch_name):
:param branch_name:
:return:
"""
resource = "plan/{plan_key}/branch/{branch_name}".format(
plan_key=plan_key, branch_name=branch_name
)
resource = "plan/{plan_key}/branch/{branch_name}".format(plan_key=plan_key, branch_name=branch_name)
return self.get(self.resource_url(resource))

def create_branch(
Expand All @@ -286,9 +272,7 @@ def create_branch(
:param cleanup_enabled: bool
:return: PUT request
"""
resource = "plan/{plan_key}/branch/{branch_name}".format(
plan_key=plan_key, branch_name=branch_name
)
resource = "plan/{plan_key}/branch/{branch_name}".format(plan_key=plan_key, branch_name=branch_name)
params = {}
if vcs_branch:
params = dict(
Expand Down Expand Up @@ -350,9 +334,7 @@ def results(
"""
resource = "result"
if project_key and plan_key and job_key and build_number:
resource += "/{}-{}-{}/{}".format(
project_key, plan_key, job_key, build_number
)
resource += "/{}-{}-{}/{}".format(project_key, plan_key, job_key, build_number)
elif project_key and plan_key and build_number:
resource += "/{}-{}/{}".format(project_key, plan_key, build_number)
elif project_key and plan_key:
Expand Down Expand Up @@ -489,9 +471,7 @@ def plan_results(
include_all_states=include_all_states,
)

def build_result(
self, build_key, expand=None, include_all_states=False, start=0, max_results=25
):
def build_result(self, build_key, expand=None, include_all_states=False, start=0, max_results=25):
"""
Returns details of a specific build result
:param expand: expands build result details on request. Possible values are: artifacts, comments, labels,
Expand All @@ -516,9 +496,7 @@ def build_result(
include_all_states=include_all_states,
)
except ValueError:
raise ValueError(
'The key "{}" does not correspond to a build result'.format(build_key)
)
raise ValueError('The key "{}" does not correspond to a build result'.format(build_key))

def build_latest_result(self, plan_key, expand=None, include_all_states=False):
"""
Expand All @@ -541,11 +519,7 @@ def build_latest_result(self, plan_key, expand=None, include_all_states=False):
include_all_states=include_all_states,
)
except ValueError:
raise ValueError(
'The key "{}" does not correspond to the latest build result'.format(
plan_key
)
)
raise ValueError('The key "{}" does not correspond to the latest build result'.format(plan_key))

def delete_build_result(self, build_key):
"""
Expand All @@ -557,18 +531,9 @@ def delete_build_result(self, build_key):
plan_key = "{}-{}".format(build_key[0], build_key[1])
build_number = build_key[2]
params = {"buildKey": plan_key, "buildNumber": build_number}
return self.post(
custom_resource, params=params, headers=self.form_token_headers
)
return self.post(custom_resource, params=params, headers=self.form_token_headers)

def execute_build(
self,
plan_key,
stage=None,
execute_all_stages=True,
custom_revision=None,
**bamboo_variables
):
def execute_build(self, plan_key, stage=None, execute_all_stages=True, custom_revision=None, **bamboo_variables):
"""
Fire build execution for specified plan.
!IMPORTANT! NOTE: for some reason, this method always execute all stages
Expand Down Expand Up @@ -604,9 +569,7 @@ def stop_build(self, plan_key):

""" Comments & Labels """

def comments(
self, project_key, plan_key, build_number, start_index=0, max_results=25
):
def comments(self, project_key, plan_key, build_number, start_index=0, max_results=25):
resource = "result/{}-{}-{}/comment".format(project_key, plan_key, build_number)
params = {"start-index": start_index, "max-results": max_results}
return self.get(self.resource_url(resource), params=params)
Expand All @@ -619,9 +582,7 @@ def create_comment(self, project_key, plan_key, build_number, comment, author=No
}
return self.post(self.resource_url(resource), data=comment_data)

def labels(
self, project_key, plan_key, build_number, start_index=0, max_results=25
):
def labels(self, project_key, plan_key, build_number, start_index=0, max_results=25):
resource = "result/{}-{}-{}/label".format(project_key, plan_key, build_number)
params = {"start-index": start_index, "max-results": max_results}
return self.get(self.resource_url(resource), params=params)
Expand All @@ -631,9 +592,7 @@ def create_label(self, project_key, plan_key, build_number, label):
return self.post(self.resource_url(resource), data={"name": label})

def delete_label(self, project_key, plan_key, build_number, label):
resource = "result/{}-{}-{}/label/{}".format(
project_key, plan_key, build_number, label
)
resource = "result/{}-{}-{}/label/{}".format(project_key, plan_key, build_number, label)
return self.delete(self.resource_url(resource))

def get_projects(self):
Expand Down Expand Up @@ -667,9 +626,7 @@ def deployment_project(self, project_id):
return self.get(self.resource_url(resource))

def deployment_environment_results(self, env_id, expand=None, max_results=25):
resource = "deploy/environment/{environmentId}/results".format(
environmentId=env_id
)
resource = "deploy/environment/{environmentId}/results".format(environmentId=env_id)
params = {"max-result": max_results, "start-index": 0}
size = 1
if expand:
Expand All @@ -686,11 +643,7 @@ def deployment_dashboard(self, project_id=None):
Returns the current status of each deployment environment
If no project id is provided, returns all projects.
"""
resource = (
"deploy/dashboard/{}".format(project_id)
if project_id
else "deploy/dashboard"
)
resource = "deploy/dashboard/{}".format(project_id) if project_id else "deploy/dashboard"
return self.get(self.resource_url(resource))

""" Users & Groups """
Expand Down
Loading