Skip to content

Commit 251ff12

Browse files
authored
Build: avoid breaking builds when a new argument is added to a task (#10374)
For #10289 we are going to need to pass a new argument (build_api_key). And since we deploy webs first, builders will have the old task that doesn't match the new signature, and the task will fail. To avoid this, we can just accept any kwargs, this obviously only works if the change is backwards compatible with the old code from the builders (in this case it will be).
1 parent 579295d commit 251ff12

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

readthedocs/projects/tasks/builds.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ def execute(self):
238238
base=SyncRepositoryTask,
239239
bind=True,
240240
)
241-
def sync_repository_task(self, version_id):
241+
def sync_repository_task(self, version_id, **kwargs):
242+
# In case we pass more arguments than expected, log them and ignore them,
243+
# so we don't break builds while we deploy a change that requires an extra argument.
244+
if kwargs:
245+
log.warning("Extra arguments passed to sync_repository_task", arguments=kwargs)
242246
lock_id = f"{self.name}-lock-{self.data.project.slug}"
243247
with memcache_lock(
244248
lock_id=lock_id, lock_expire=60, app_identifier=self.app.oid
@@ -939,5 +943,9 @@ def send_notifications(self, version_pk, build_pk, event):
939943
bind=True,
940944
ignore_result=True,
941945
)
942-
def update_docs_task(self, version_id, build_id, build_commit=None):
946+
def update_docs_task(self, version_id, build_id, build_commit=None, **kwargs):
947+
# In case we pass more arguments than expected, log them and ignore them,
948+
# so we don't break builds while we deploy a change that requires an extra argument.
949+
if kwargs:
950+
log.warning("Extra arguments passed to update_docs_task", arguments=kwargs)
943951
self.execute()

0 commit comments

Comments
 (0)