Skip to content

Commit 9bdffa3

Browse files
authored
Merge pull request #8943 from readthedocs/humitos/reset-build-error
Build: reset build error before start building
2 parents 2d11aba + 3484057 commit 9bdffa3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

readthedocs/projects/tasks/builds.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ def before_start(self, task_id, args, kwargs):
329329
# Save the builder instance's name into the build object
330330
self.data.build['builder'] = socket.gethostname()
331331

332+
# Reset any previous build error reported to the user
333+
self.data.build['error'] = ''
334+
332335
# Also note there are builds that are triggered without a commit
333336
# because they just build the latest commit for that version
334337
self.data.build_commit = kwargs.get('build_commit')

readthedocs/projects/tests/test_build_tasks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def test_successful_build(self, load_yaml_config, clean_build, send_notification
283283
'id': 1,
284284
'state': 'cloning',
285285
'commit': 'a1b2c3',
286+
'error': '',
286287
'builder': mock.ANY,
287288
}
288289

@@ -331,6 +332,7 @@ def test_successful_build(self, load_yaml_config, clean_build, send_notification
331332
'commit': 'a1b2c3',
332333
'config': mock.ANY,
333334
'builder': mock.ANY,
335+
'error': '',
334336
}
335337
# Update build state: building
336338
assert self.requests_mock.request_history[6].json() == {
@@ -339,6 +341,7 @@ def test_successful_build(self, load_yaml_config, clean_build, send_notification
339341
'commit': 'a1b2c3',
340342
'config': mock.ANY,
341343
'builder': mock.ANY,
344+
'error': '',
342345
}
343346
# Update build state: uploading
344347
assert self.requests_mock.request_history[7].json() == {
@@ -347,6 +350,7 @@ def test_successful_build(self, load_yaml_config, clean_build, send_notification
347350
'commit': 'a1b2c3',
348351
'config': mock.ANY,
349352
'builder': mock.ANY,
353+
'error': '',
350354
}
351355
# Update version state
352356
assert self.requests_mock.request_history[8]._request.method == 'PATCH'
@@ -371,6 +375,7 @@ def test_successful_build(self, load_yaml_config, clean_build, send_notification
371375
'builder': mock.ANY,
372376
'length': mock.ANY,
373377
'success': True,
378+
'error': '',
374379
}
375380

376381
self.mocker.mocks['build_media_storage'].sync_directory.assert_has_calls([

0 commit comments

Comments
 (0)