@@ -72,32 +72,33 @@ def issue(
72
72
):
73
73
# Open an issue about the toolstate failure.
74
74
assignees = [x .strip () for x in maintainers .split ('@' ) if x != '' ]
75
- assignees .append (relevant_pr_user )
76
75
if status == 'test-fail' :
77
76
status_description = 'has failing tests'
78
77
else :
79
78
status_description = 'no longer builds'
79
+ request = json .dumps ({
80
+ 'body' : maybe_delink (textwrap .dedent ('''\
81
+ Hello, this is your friendly neighborhood mergebot.
82
+ After merging PR {}, I observed that the tool {} {}.
83
+ A follow-up PR to the repository {} is needed to fix the fallout.
84
+
85
+ cc @{}, do you think you would have time to do the follow-up work?
86
+ If so, that would be great!
87
+
88
+ cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
89
+
90
+ ''' ).format (
91
+ relevant_pr_number , tool , status_description ,
92
+ REPOS .get (tool ), relevant_pr_user , pr_reviewer
93
+ )),
94
+ 'title' : '`{}` no longer builds after {}' .format (tool , relevant_pr_number ),
95
+ 'assignees' : assignees ,
96
+ 'labels' : ['T-compiler' , 'I-nominated' ],
97
+ })
98
+ print ("Creating issue:\n {}" .format (request ))
80
99
response = urllib2 .urlopen (urllib2 .Request (
81
100
gh_url (),
82
- json .dumps ({
83
- 'body' : maybe_delink (textwrap .dedent ('''\
84
- Hello, this is your friendly neighborhood mergebot.
85
- After merging PR {}, I observed that the tool {} {}.
86
- A follow-up PR to the repository {} is needed to fix the fallout.
87
-
88
- cc @{}, do you think you would have time to do the follow-up work?
89
- If so, that would be great!
90
-
91
- cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
92
-
93
- ''' ).format (
94
- relevant_pr_number , tool , status_description ,
95
- REPOS .get (tool ), relevant_pr_user , pr_reviewer
96
- )),
97
- 'title' : '`{}` no longer builds after {}' .format (tool , relevant_pr_number ),
98
- 'assignees' : assignees ,
99
- 'labels' : ['T-compiler' , 'I-nominated' ],
100
- }),
101
+ request ,
101
102
{
102
103
'Authorization' : 'token ' + github_token ,
103
104
'Content-Type' : 'application/json' ,
@@ -135,13 +136,13 @@ def update_latest(
135
136
for status in latest :
136
137
tool = status ['tool' ]
137
138
changed = False
138
- create_issue = False
139
+ create_issue_for_status = None # set to the status that caused the issue
139
140
140
141
for os , s in current_status .items ():
141
142
old = status [os ]
142
143
new = s .get (tool , old )
143
144
status [os ] = new
144
- if new > old :
145
+ if new > old : # comparing the strings, but they are ordered appropriately!
145
146
# things got fixed or at least the status quo improved
146
147
changed = True
147
148
message += '🎉 {} on {}: {} → {} (cc {}, @rust-lang/infra).\n ' \
@@ -156,20 +157,24 @@ def update_latest(
156
157
# Most tools only create issues for build failures.
157
158
# Other failures can be spurious.
158
159
if new == 'build-fail' or (tool == 'miri' and new == 'test-fail' ):
159
- create_issue = True
160
+ create_issue_for_status = new
160
161
161
- if create_issue :
162
+ if create_issue_for_status is not None :
162
163
try :
163
164
issue (
164
- tool , new , MAINTAINERS .get (tool , '' ),
165
+ tool , create_issue_for_status , MAINTAINERS .get (tool , '' ),
165
166
relevant_pr_number , relevant_pr_user , pr_reviewer ,
166
167
)
167
- except IOError as e :
168
+ except urllib2 . HTTPError as e :
168
169
# network errors will simply end up not creating an issue, but that's better
169
170
# than failing the entire build job
170
- print ("I/O error: {0}" .format (e ))
171
+ print ("HTTPError when creating issue for status regression: {0}\n {1}"
172
+ .format (e , e .read ()))
173
+ except IOError as e :
174
+ print ("I/O error when creating issue for status regression: {0}" .format (e ))
171
175
except :
172
- print ("Unexpected error: {0}" .format (sys .exc_info ()[0 ]))
176
+ print ("Unexpected error when creating issue for status regression: {0}"
177
+ .format (sys .exc_info ()[0 ]))
173
178
raise
174
179
175
180
if changed :
0 commit comments