Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit a9b954a

Browse files
authored
Merge pull request #484 from CMSCompOps/FC_bypass_from_jira
force-complete and bypass directly from jira
2 parents 90a50d8 + 2dc77d1 commit a9b954a

2 files changed

Lines changed: 37 additions & 4 deletions

File tree

JIRAClient.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,14 @@ def find(self ,specifications):
143143
else:
144144
query += ' AND status = %s'%(status)
145145

146-
if specifications.get('label'):
146+
if specifications.get('label',None):
147147
label = specifications['label']
148148
query += ' AND labels = %s'%label
149149

150+
if specifications.get('text',None):
151+
string = specifications['text']
152+
query += ' AND text ~ "%s"'% string
153+
150154
return self._find( query )
151155

152156
def comment(self, key, comment):

Unified/checkor.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,44 @@ def time_point(label="",sub_lap=False, percent=None):
137137
print user,"is bypassing",extending
138138
bypasses.extend( extending )
139139

140-
overrides = {}
140+
overrides = defaultdict(list)
141141
for user,extending in WI.getForce().items():
142142
if not user in actors:
143143
print user,"is not allowed to force complete"
144144
continue
145145
print user,"is force-completing",extending
146146
bypasses.extend( extending )
147-
overrides[user] = extending
148-
147+
overrides[user].extend(extending)
148+
149+
if JC:
150+
force_complete_jira_string = "cmsunified please do force-complete"
151+
to_check = JC.find({'text' : force_complete_jira_string, "status" : "!CLOSED"})
152+
for j in to_check:
153+
jira = JC.get(j.key)
154+
for c in jira.fields.comment.comments:
155+
if force_complete_jira_string in c.body:
156+
user = c.author.name
157+
prepid = jira.fields.summary.split()[0]
158+
keyword = c.body[(c.body.find(force_complete_jira_string)+len(force_complete_jira_string)):].split()[0]
159+
if keyword and user in actors:
160+
print user,"is force-completing", keyword,"from JIRA"
161+
bypasses.extend( keyword )
162+
overrides[user].extend( keyword )
163+
break
164+
bypass_jira_string = "cmsunified please do bypass"
165+
to_check = JC.find({'text' : bypass_jira_string, "status" : "!CLOSED"})
166+
for j in to_check:
167+
jira = JC.get(j.key)
168+
for c in jira.fields.comment.comments:
169+
if bypass_jira_string in c.body:
170+
user = c.author.name
171+
prepid = jira.fields.summary.split()[0]
172+
keyword = c.body[(c.body.find(bypass_jira_string)+len(bypass_jira_string)):].split()[0]
173+
if keyword and user in actors:
174+
print user,"is bypassing", keyword,"from JIRA"
175+
bypasses.extend( keyword )
176+
break
177+
149178
if use_mcm:
150179
## this is a list of prepids that are good to complete
151180
forcings = mcm.get('/restapi/requests/forcecomplete')

0 commit comments

Comments
 (0)