Skip to content

Commit 121796c

Browse files
authored
Repo sync: use project queue for syncing (#12529)
Some projects require using the custom queue/builder for interacting with git
1 parent 0694d42 commit 121796c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

readthedocs/core/views/hooks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,17 @@ def trigger_sync_versions(project):
118118
project_slug=version.project.slug,
119119
version_slug=version.slug,
120120
)
121+
122+
options = {}
123+
# Use custom queue if defined, as some repositories need to
124+
# be synced from a specific queue (like IP restricted ones).
125+
if project.build_queue:
126+
options["queue"] = project.build_queue
127+
121128
sync_repository_task.apply_async(
122129
args=[version.pk],
123130
kwargs={"build_api_key": build_api_key},
131+
**options,
124132
)
125133
return version.slug
126134
except Exception:

readthedocs/rtd_tests/tests/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ def test_sync_repository_custom_project_queue(
20322032
self, sync_repository_task, trigger_build
20332033
):
20342034
"""
2035-
Check that the custom queue isn't used for sync_repository_task.
2035+
Check that the custom queue is used for sync_repository_task.
20362036
"""
20372037
client = APIClient()
20382038
self.project.build_queue = "specific-build-queue"
@@ -2064,7 +2064,7 @@ def test_sync_repository_custom_project_queue(
20642064
kwargs={
20652065
"build_api_key": mock.ANY,
20662066
},
2067-
# No queue
2067+
queue="specific-build-queue",
20682068
)
20692069

20702070
def test_github_webhook_for_branches(self, trigger_build):

0 commit comments

Comments
 (0)