@@ -61,6 +61,15 @@ def base_list_call(self, resource, expand, favourite, clover_enabled, max_result
61
61
params ['start-index' ] = start_index
62
62
return self .get (self .resource_url (resource ), flags = flags , params = params )
63
63
64
+ def get_custom_expiry (self , limit = 25 ):
65
+ """
66
+ Get list of all plans where user has admin permission and which override global expiry settings.
67
+ If global expiry is not enabled it returns empty response.
68
+ :param limit:
69
+ """
70
+ url = "rest/api/latest/admin/expiry/custom/plan?limit={}" .format (limit )
71
+ return self .get (url )
72
+
64
73
def plan_directory_info (self , plan_key ):
65
74
"""
66
75
Returns information about the directories where artifacts, build logs, and build results will be stored.
@@ -95,7 +104,7 @@ def plans(self, expand=None, favourite=False, clover_enabled=False, start_index=
95
104
elements_key = 'plans' , element_key = 'plan' )
96
105
97
106
def results (self , project_key = None , plan_key = None , job_key = None , build_number = None , expand = None , favourite = False ,
98
- clover_enabled = False , issue_key = None , label = None , start_index = 0 , max_results = 25 ):
107
+ clover_enabled = False , issue_key = None , label = None , start_index = 0 , max_results = 25 , include_all_states = False ):
99
108
"""
100
109
Get results as generic method
101
110
:param project_key:
@@ -109,6 +118,7 @@ def results(self, project_key=None, plan_key=None, job_key=None, build_number=No
109
118
:param label:
110
119
:param start_index:
111
120
:param max_results:
121
+ :param include_all_states:
112
122
:return:
113
123
"""
114
124
resource = "result"
@@ -124,12 +134,14 @@ def results(self, project_key=None, plan_key=None, job_key=None, build_number=No
124
134
params = {}
125
135
if issue_key :
126
136
params ['issueKey' ] = issue_key
137
+ if include_all_states :
138
+ params ['includeAllStates' ] = include_all_states
127
139
return self .base_list_call (resource , expand = expand , favourite = favourite , clover_enabled = clover_enabled ,
128
140
start_index = start_index , max_results = max_results ,
129
141
elements_key = 'results' , element_key = 'result' , label = label , ** params )
130
142
131
143
def latest_results (self , expand = None , favourite = False , clover_enabled = False , label = None , issue_key = None ,
132
- start_index = 0 , max_results = 25 ):
144
+ start_index = 0 , max_results = 25 , include_all_states = False ):
133
145
"""
134
146
Get latest Results
135
147
:param expand:
@@ -139,13 +151,14 @@ def latest_results(self, expand=None, favourite=False, clover_enabled=False, lab
139
151
:param issue_key:
140
152
:param start_index:
141
153
:param max_results:
154
+ :param include_all_states:
142
155
:return:
143
156
"""
144
157
return self .results (expand = expand , favourite = favourite , clover_enabled = clover_enabled ,
145
- label = label , issue_key = issue_key , start_index = start_index , max_results = max_results )
158
+ label = label , issue_key = issue_key , start_index = start_index , max_results = max_results , include_all_states = include_all_states )
146
159
147
160
def project_latest_results (self , project_key , expand = None , favourite = False , clover_enabled = False , label = None ,
148
- issue_key = None , start_index = 0 , max_results = 25 ):
161
+ issue_key = None , start_index = 0 , max_results = 25 , include_all_states = False ):
149
162
"""
150
163
Get latest Project Results
151
164
:param project_key:
@@ -156,13 +169,14 @@ def project_latest_results(self, project_key, expand=None, favourite=False, clov
156
169
:param issue_key:
157
170
:param start_index:
158
171
:param max_results:
172
+ :param include_all_states:
159
173
:return:
160
174
"""
161
175
return self .results (project_key , expand = expand , favourite = favourite , clover_enabled = clover_enabled ,
162
- label = label , issue_key = issue_key , start_index = start_index , max_results = max_results )
176
+ label = label , issue_key = issue_key , start_index = start_index , max_results = max_results , include_all_states = include_all_states )
163
177
164
178
def plan_results (self , project_key , plan_key , expand = None , favourite = False , clover_enabled = False , label = None ,
165
- issue_key = None , start_index = 0 , max_results = 25 ):
179
+ issue_key = None , start_index = 0 , max_results = 25 , include_all_states = False ):
166
180
"""
167
181
Get Plan results
168
182
:param project_key:
@@ -174,12 +188,13 @@ def plan_results(self, project_key, plan_key, expand=None, favourite=False, clov
174
188
:param issue_key:
175
189
:param start_index:
176
190
:param max_results:
191
+ :param include_all_states:
177
192
:return:
178
193
"""
179
194
return self .results (project_key , plan_key , expand = expand , favourite = favourite , clover_enabled = clover_enabled ,
180
- label = label , issue_key = issue_key , start_index = start_index , max_results = max_results )
195
+ label = label , issue_key = issue_key , start_index = start_index , max_results = max_results , include_all_states = include_all_states )
181
196
182
- def build_result (self , build_key , expand = None ):
197
+ def build_result (self , build_key , expand = None , include_all_states = False ):
183
198
"""
184
199
Returns details of a specific build result
185
200
:param expand: expands build result details on request. Possible values are: artifacts, comments, labels,
@@ -192,22 +207,23 @@ def build_result(self, build_key, expand=None):
192
207
int (build_key .split ('-' )[- 1 ])
193
208
resource = "result/{}" .format (build_key )
194
209
return self .base_list_call (resource , expand , favourite = False , clover_enabled = False ,
195
- start_index = 0 , max_results = 25 )
210
+ start_index = 0 , max_results = 25 , include_all_states = include_all_states )
196
211
except ValueError :
197
212
raise ValueError ('The key "{}" does not correspond to a build result' .format (build_key ))
198
213
199
- def build_latest_result (self , plan_key , expand = None ):
214
+ def build_latest_result (self , plan_key , expand = None , include_all_states = False ):
200
215
"""
201
216
Returns details of a latest build result
202
217
:param expand: expands build result details on request. Possible values are: artifacts, comments, labels,
203
218
Jira Issues, stages. stages expand is available only for top level plans. It allows to drill down to job results
204
219
using stages.stage.results.result. All expand parameters should contain results.result prefix.
205
220
:param plan_key: Should be in the form XX-YY[-ZZ]
221
+ :param include_all_states:
206
222
"""
207
223
try :
208
224
resource = "result/{}/latest.json" .format (plan_key )
209
225
return self .base_list_call (resource , expand , favourite = False , clover_enabled = False ,
210
- start_index = 0 , max_results = 25 )
226
+ start_index = 0 , max_results = 25 , include_all_states = include_all_states )
211
227
except ValueError :
212
228
raise ValueError ('The key "{}" does not correspond to the latest build result' .format (plan_key ))
213
229
0 commit comments