Skip to content

Commit

Permalink
Build: do not send VCS build status on specific exceptions
Browse files Browse the repository at this point in the history
When the exception is an exception we know it does not require communicating the
VCS service about its state, we avoid sending the build status to the VCS
service.

This is currently used to avoid sending a "failure" (red cross) notification
when the build is marked as duplicated. In the future, it could also be used
when the build is auto-cancelled because a new commit on the same branch was
done (see #8961)

Closes #9040
  • Loading branch information
humitos committed Mar 30, 2022
1 parent 3456634 commit cf5221f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion readthedocs/projects/tasks/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ class UpdateDocsTask(SyncRepositoryMixin, Task):
ProjectBuildsSkippedError,
)

# Do not send external build status on failure builds for these exceptions.
exceptions_without_external_build_status = (DuplicatedBuildError,)

acks_late = True
track_started = True

Expand Down Expand Up @@ -407,7 +410,9 @@ def on_failure(self, exc, task_id, args, kwargs, einfo):
# Oh, I think this is to differentiate a task triggered with
# `Build.commit` than a one triggered just with the `Version` to build
# the _latest_ commit of it
if self.data.build_commit:
if self.data.build_commit and not isinstance(
exc, self.exceptions_without_external_build_status
):
send_external_build_status(
version_type=self.data.version.type,
build_pk=self.data.build['id'],
Expand Down

0 comments on commit cf5221f

Please sign in to comment.