From d028222bd6d457c6943e071158fe210f2a06a76b Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Wed, 24 Jul 2019 14:20:00 +0600 Subject: [PATCH 1/6] fix github build status bug --- readthedocs/oauth/services/github.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/readthedocs/oauth/services/github.py b/readthedocs/oauth/services/github.py index d7701c54293..5bb4b5fb6d3 100644 --- a/readthedocs/oauth/services/github.py +++ b/readthedocs/oauth/services/github.py @@ -13,6 +13,7 @@ from readthedocs.api.v2.client import api from readthedocs.builds import utils as build_utils from readthedocs.builds.constants import ( + BUILD_STATUS_PENDING, SELECT_BUILD_STATUS, RTD_BUILD_STATUS_API_NAME ) @@ -329,7 +330,11 @@ def send_build_status(self, build, state): session = self.get_session() project = build.project owner, repo = build_utils.get_github_username_repo(url=project.repo) - build_sha = build.version.identifier + + if state == BUILD_STATUS_PENDING: + build_sha = build.version.identifier + else: + build_sha = build.commit # select the correct state and description. github_build_state = SELECT_BUILD_STATUS[state]['github'] From 49716a7e7134d0e6a7383aa923925b3bc121e445 Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Wed, 24 Jul 2019 21:26:24 +0600 Subject: [PATCH 2/6] commit sha passed to build status reporting task --- readthedocs/core/utils/__init__.py | 5 +++- readthedocs/oauth/services/base.py | 4 ++- readthedocs/oauth/services/github.py | 12 +++----- readthedocs/projects/tasks.py | 29 +++++++++++++------ readthedocs/rtd_tests/tests/test_celery.py | 12 ++++++-- .../tests/test_config_integration.py | 6 +++- readthedocs/rtd_tests/tests/test_oauth.py | 4 ++- .../rtd_tests/tests/test_projects_tasks.py | 18 ++++++++---- 8 files changed, 61 insertions(+), 29 deletions(-) diff --git a/readthedocs/core/utils/__init__.py b/readthedocs/core/utils/__init__.py index ab132ec7bc9..a5529828edf 100644 --- a/readthedocs/core/utils/__init__.py +++ b/readthedocs/core/utils/__init__.py @@ -133,7 +133,10 @@ def prepare_build( if build: # Send pending Build Status using Git Status API for External Builds. - send_external_build_status(version=version, build_pk=build.id, status=BUILD_STATUS_PENDING) + send_external_build_status( + version_type=version.type, build_pk=build.id, + commit=version.identifier, status=BUILD_STATUS_PENDING + ) return ( update_docs_task.signature( diff --git a/readthedocs/oauth/services/base.py b/readthedocs/oauth/services/base.py index ba21e56c085..3e508c80e3d 100644 --- a/readthedocs/oauth/services/base.py +++ b/readthedocs/oauth/services/base.py @@ -250,12 +250,14 @@ def update_webhook(self, project, integration): """ raise NotImplementedError - def send_build_status(self, build, state): + def send_build_status(self, build, commit, state): """ Create commit status for project. :param build: Build to set up commit status for :type build: Build + :param commit: commit sha of the pull/merge request + :type commit: str :param state: build state failure, pending, or success. :type state: str :returns: boolean based on commit status creation was successful or not. diff --git a/readthedocs/oauth/services/github.py b/readthedocs/oauth/services/github.py index 5bb4b5fb6d3..e14376ee805 100644 --- a/readthedocs/oauth/services/github.py +++ b/readthedocs/oauth/services/github.py @@ -13,7 +13,6 @@ from readthedocs.api.v2.client import api from readthedocs.builds import utils as build_utils from readthedocs.builds.constants import ( - BUILD_STATUS_PENDING, SELECT_BUILD_STATUS, RTD_BUILD_STATUS_API_NAME ) @@ -316,7 +315,7 @@ def update_webhook(self, project, integration): ) return (False, resp) - def send_build_status(self, build, state): + def send_build_status(self, build, commit, state): """ Create GitHub commit status for project. @@ -324,6 +323,8 @@ def send_build_status(self, build, state): :type build: Build :param state: build state failure, pending, or success. :type state: str + :param commit: commit sha of the pull request + :type commit: str :returns: boolean based on commit status creation was successful or not. :rtype: Bool """ @@ -331,11 +332,6 @@ def send_build_status(self, build, state): project = build.project owner, repo = build_utils.get_github_username_repo(url=project.repo) - if state == BUILD_STATUS_PENDING: - build_sha = build.version.identifier - else: - build_sha = build.commit - # select the correct state and description. github_build_state = SELECT_BUILD_STATUS[state]['github'] description = SELECT_BUILD_STATUS[state]['description'] @@ -351,7 +347,7 @@ def send_build_status(self, build, state): try: resp = session.post( - f'https://api.github.com/repos/{owner}/{repo}/statuses/{build_sha}', + f'https://api.github.com/repos/{owner}/{repo}/statuses/{commit}', data=json.dumps(data), headers={'content-type': 'application/json'}, ) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 5106c9f7337..cc20f70fdfe 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -579,16 +579,25 @@ def run_build(self, docker, record): if self.build_env.failed: self.send_notifications(self.version.pk, self.build['id']) send_external_build_status( - version=self.version, build_pk=self.build['id'], status=BUILD_STATUS_FAILURE + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.build['commit'], + status=BUILD_STATUS_FAILURE ) elif self.build_env.successful: send_external_build_status( - version=self.version, build_pk=self.build['id'], status=BUILD_STATUS_SUCCESS + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.build['commit'], + status=BUILD_STATUS_SUCCESS ) else: msg = 'Unhandled Build Status' send_external_build_status( - version=self.version, build_pk=self.build['id'], status=BUILD_STATUS_FAILURE + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.build['commit'], + status=BUILD_STATUS_FAILURE ) log.warning( LOG_TEMPLATE, @@ -1822,11 +1831,12 @@ def retry_domain_verification(domain_pk): @app.task(queue='web') -def send_build_status(build_pk, status): +def send_build_status(build_pk, commit, status): """ Send Build Status to Git Status API for project external versions. :param build_pk: Build primary key + :param commit: commit sha of the pull/merge request :param status: build status failed, pending, or success to be sent. """ build = Build.objects.get(pk=build_pk) @@ -1838,7 +1848,7 @@ def send_build_status(build_pk, status): ) # send Status report using the API. - service.send_build_status(build, status) + service.send_build_status(build, commit, status) except RemoteRepository.DoesNotExist: log.info('Remote repository does not exist for %s', build.project) @@ -1849,16 +1859,17 @@ def send_build_status(build_pk, status): # TODO: Send build status for other providers. -def send_external_build_status(version, build_pk, status): +def send_external_build_status(version_type, build_pk, commit, status): """ Check if build is external and Send Build Status for project external versions. - :param version: Version instance + :param version_type: Version type e.g EXTERNAL, BRANCH, TAG :param build_pk: Build pk + :param commit: commit sha of the pull/merge request :param status: build status failed, pending, or success to be sent. """ # Send status reports for only External (pull/merge request) Versions. - if version.type == EXTERNAL: + if version_type == EXTERNAL: # call the task that actually send the build status. - send_build_status.delay(build_pk, status) + send_build_status.delay(build_pk, commit, status) diff --git a/readthedocs/rtd_tests/tests/test_celery.py b/readthedocs/rtd_tests/tests/test_celery.py index 441d5873583..d7a0dc3442d 100644 --- a/readthedocs/rtd_tests/tests/test_celery.py +++ b/readthedocs/rtd_tests/tests/test_celery.py @@ -343,9 +343,13 @@ def test_send_build_status_task(self, send_build_status): external_build = get( Build, project=self.project, version=external_version ) - tasks.send_build_status(external_build.id, BUILD_STATUS_SUCCESS) + tasks.send_build_status( + external_build.id, external_build.commit, BUILD_STATUS_SUCCESS + ) - send_build_status.assert_called_once_with(external_build, BUILD_STATUS_SUCCESS) + send_build_status.assert_called_once_with( + external_build, external_build.commit, BUILD_STATUS_SUCCESS + ) @patch('readthedocs.projects.tasks.GitHubService.send_build_status') def test_send_build_status_task_without_remote_repo(self, send_build_status): @@ -353,6 +357,8 @@ def test_send_build_status_task_without_remote_repo(self, send_build_status): external_build = get( Build, project=self.project, version=external_version ) - tasks.send_build_status(external_build.id, BUILD_STATUS_SUCCESS) + tasks.send_build_status( + external_build.id, external_build.commit, BUILD_STATUS_SUCCESS + ) send_build_status.assert_not_called() diff --git a/readthedocs/rtd_tests/tests/test_config_integration.py b/readthedocs/rtd_tests/tests/test_config_integration.py index 394df0c53e8..bdfa9e36b93 100644 --- a/readthedocs/rtd_tests/tests/test_config_integration.py +++ b/readthedocs/rtd_tests/tests/test_config_integration.py @@ -368,7 +368,11 @@ def get_update_docs_task(self): config=load_yaml_config(self.version), project=self.project, version=self.version, - build={'id': 99, 'state': BUILD_STATE_TRIGGERED} + build={ + 'id': 99, + 'state': BUILD_STATE_TRIGGERED, + 'commit': 'abc859dada4faf' + } ) return update_docs diff --git a/readthedocs/rtd_tests/tests/test_oauth.py b/readthedocs/rtd_tests/tests/test_oauth.py index 3cf88f2d40d..e1d11156fca 100644 --- a/readthedocs/rtd_tests/tests/test_oauth.py +++ b/readthedocs/rtd_tests/tests/test_oauth.py @@ -156,6 +156,7 @@ def test_send_build_status_successful(self, session, mock_logger): session().post.return_value.status_code = 201 success = self.service.send_build_status( self.external_build, + self.external_build.commit, BUILD_STATUS_SUCCESS ) @@ -172,6 +173,7 @@ def test_send_build_status_404_error(self, session, mock_logger): session().post.return_value.status_code = 404 success = self.service.send_build_status( self.external_build, + self.external_build.commit, BUILD_STATUS_SUCCESS ) @@ -187,7 +189,7 @@ def test_send_build_status_404_error(self, session, mock_logger): def test_send_build_status_value_error(self, session, mock_logger): session().post.side_effect = ValueError success = self.service.send_build_status( - self.external_build, BUILD_STATUS_SUCCESS + self.external_build, self.external_build.commit, BUILD_STATUS_SUCCESS ) self.assertFalse(success) diff --git a/readthedocs/rtd_tests/tests/test_projects_tasks.py b/readthedocs/rtd_tests/tests/test_projects_tasks.py index 1794cb17d54..e02f851f2b1 100644 --- a/readthedocs/rtd_tests/tests/test_projects_tasks.py +++ b/readthedocs/rtd_tests/tests/test_projects_tasks.py @@ -138,14 +138,22 @@ def setUp(self): @patch('readthedocs.projects.tasks.send_build_status') def test_send_external_build_status_with_external_version(self, send_build_status): - send_external_build_status(self.external_version, - self.external_build.id, BUILD_STATUS_SUCCESS) + send_external_build_status( + self.external_version.type, self.external_build.id, + self.external_build.commit, BUILD_STATUS_SUCCESS + ) - send_build_status.delay.assert_called_once_with(self.external_build.id, BUILD_STATUS_SUCCESS) + send_build_status.delay.assert_called_once_with( + self.external_build.id, + self.external_build.commit, + BUILD_STATUS_SUCCESS + ) @patch('readthedocs.projects.tasks.send_build_status') def test_send_external_build_status_with_internal_version(self, send_build_status): - send_external_build_status(self.internal_version, - self.internal_build.id, BUILD_STATUS_SUCCESS) + send_external_build_status( + self.internal_version.type, self.internal_build.id, + self.external_build.commit, BUILD_STATUS_SUCCESS + ) send_build_status.delay.assert_not_called() From af200541481d82aaac5a45570cbb2c37ac253e6f Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Thu, 25 Jul 2019 20:02:50 +0600 Subject: [PATCH 3/6] added commit to builder --- readthedocs/api/v2/views/integrations.py | 4 +- readthedocs/core/utils/__init__.py | 11 +++- readthedocs/core/views/hooks.py | 4 +- readthedocs/projects/tasks.py | 66 +++++++++++-------- readthedocs/rtd_tests/tests/test_api.py | 12 ++-- .../tests/test_config_integration.py | 3 +- .../rtd_tests/tests/test_core_utils.py | 6 ++ 7 files changed, 66 insertions(+), 40 deletions(-) diff --git a/readthedocs/api/v2/views/integrations.py b/readthedocs/api/v2/views/integrations.py index 187cc323831..fd3cdedeb98 100644 --- a/readthedocs/api/v2/views/integrations.py +++ b/readthedocs/api/v2/views/integrations.py @@ -219,7 +219,9 @@ def get_external_version_response(self, project): project, identifier, verbose_name ) # returns external version verbose_name (pull/merge request number) - to_build = build_external_version(project, external_version) + to_build = build_external_version( + project=project, version=external_version, commit=identifier + ) return { 'build_triggered': True, diff --git a/readthedocs/core/utils/__init__.py b/readthedocs/core/utils/__init__.py index a5529828edf..aa6696d125c 100644 --- a/readthedocs/core/utils/__init__.py +++ b/readthedocs/core/utils/__init__.py @@ -60,6 +60,7 @@ def broadcast(type, task, args, kwargs=None, callback=None): # pylint: disable= def prepare_build( project, version=None, + commit=None, record=True, force=False, immutable=True, @@ -72,6 +73,7 @@ def prepare_build( :param project: project's documentation to be built :param version: version of the project to be built. Default: ``project.get_default_version()`` + :param commit: commit sha of the version required for sending build status reports :param record: whether or not record the build in a new Build object :param force: build the HTML documentation even if the files haven't changed :param immutable: whether or not create an immutable Celery signature @@ -102,6 +104,7 @@ def prepare_build( kwargs = { 'record': record, 'force': force, + 'commit': commit, } if record: @@ -131,11 +134,11 @@ def prepare_build( options['soft_time_limit'] = time_limit options['time_limit'] = int(time_limit * 1.2) - if build: + if build and commit: # Send pending Build Status using Git Status API for External Builds. send_external_build_status( version_type=version.type, build_pk=build.id, - commit=version.identifier, status=BUILD_STATUS_PENDING + commit=commit, status=BUILD_STATUS_PENDING ) return ( @@ -149,7 +152,7 @@ def prepare_build( ) -def trigger_build(project, version=None, record=True, force=False): +def trigger_build(project, version=None, commit=None, record=True, force=False): """ Trigger a Build. @@ -158,6 +161,7 @@ def trigger_build(project, version=None, record=True, force=False): :param project: project's documentation to be built :param version: version of the project to be built. Default: ``latest`` + :param commit: commit sha of the version required for sending build status reports :param record: whether or not record the build in a new Build object :param force: build the HTML documentation even if the files haven't changed :returns: Celery AsyncResult promise and Build instance @@ -166,6 +170,7 @@ def trigger_build(project, version=None, record=True, force=False): update_docs_task, build = prepare_build( project, version, + commit, record, force, immutable=True, diff --git a/readthedocs/core/views/hooks.py b/readthedocs/core/views/hooks.py index 55cfbb4c624..3a094e5565a 100644 --- a/readthedocs/core/views/hooks.py +++ b/readthedocs/core/views/hooks.py @@ -157,7 +157,7 @@ def delete_external_version(project, identifier, verbose_name): return None -def build_external_version(project, version): +def build_external_version(project, version, commit): """ Where we actually trigger builds for external versions. @@ -173,6 +173,6 @@ def build_external_version(project, version): project.slug, version.slug, ) - trigger_build(project=project, version=version, force=True) + trigger_build(project=project, version=version, commit=commit, force=True) return version.verbose_name diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index cc20f70fdfe..954b8c39d76 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -321,6 +321,7 @@ def __init__( build=None, project=None, version=None, + commit=None, task=None, ): self.build_env = build_env @@ -332,6 +333,7 @@ def __init__( self.version = {} if version is not None: self.version = version + self.commit = commit self.project = {} if project is not None: self.project = project @@ -342,7 +344,7 @@ def __init__( # pylint: disable=arguments-differ def run( - self, version_pk, build_pk=None, record=True, docker=None, + self, version_pk, build_pk=None, commit=None, record=True, docker=None, force=False, **__ ): """ @@ -363,6 +365,7 @@ def run( :param version_pk int: Project Version id :param build_pk int: Build id (if None, commands are not recorded) + :param commit: commit sha of the version required for sending build status reports :param record bool: record a build object in the database :param docker bool: use docker to build the project (if ``None``, ``settings.DOCKER_ENABLE`` is used) @@ -379,6 +382,7 @@ def run( self.project = self.version.project self.build = self.get_build(build_pk) self.build_force = force + self.commit = commit self.config = None # Build process starts here @@ -577,36 +581,42 @@ def run_build(self, docker, record): log.warning('No build ID, not syncing files') if self.build_env.failed: + # TODO: Send RTD Webhook notification for build failure. self.send_notifications(self.version.pk, self.build['id']) - send_external_build_status( - version_type=self.version.type, - build_pk=self.build['id'], - commit=self.build['commit'], - status=BUILD_STATUS_FAILURE - ) + + if self.commit: + send_external_build_status( + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.commit, + status=BUILD_STATUS_FAILURE + ) elif self.build_env.successful: - send_external_build_status( - version_type=self.version.type, - build_pk=self.build['id'], - commit=self.build['commit'], - status=BUILD_STATUS_SUCCESS - ) + # TODO: Send RTD Webhook notification for build success. + if self.commit: + send_external_build_status( + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.commit, + status=BUILD_STATUS_SUCCESS + ) else: - msg = 'Unhandled Build Status' - send_external_build_status( - version_type=self.version.type, - build_pk=self.build['id'], - commit=self.build['commit'], - status=BUILD_STATUS_FAILURE - ) - log.warning( - LOG_TEMPLATE, - { - 'project': self.project.slug, - 'version': self.version.slug, - 'msg': msg, - } - ) + if self.commit: + msg = 'Unhandled Build Status' + send_external_build_status( + version_type=self.version.type, + build_pk=self.build['id'], + commit=self.commit, + status=BUILD_STATUS_FAILURE + ) + log.warning( + LOG_TEMPLATE, + { + 'project': self.project.slug, + 'version': self.version.slug, + 'msg': msg, + } + ) build_complete.send(sender=Build, build=self.build_env.build) diff --git a/readthedocs/rtd_tests/tests/test_api.py b/readthedocs/rtd_tests/tests/test_api.py index ea44b9527a7..ac525abb7a8 100644 --- a/readthedocs/rtd_tests/tests/test_api.py +++ b/readthedocs/rtd_tests/tests/test_api.py @@ -784,12 +784,13 @@ def setUp(self): self.github_payload = { 'ref': 'master', } + self.commit = "ec26de721c3235aad62de7213c562f8c821" self.github_pull_request_payload = { "action": "opened", "number": 2, "pull_request": { "head": { - "sha": "ec26de721c3235aad62de7213c562f8c821" + "sha": self.commit } } } @@ -932,7 +933,8 @@ def test_github_pull_request_opened_event(self, trigger_build, core_trigger_buil self.assertEqual(resp.data['project'], self.project.slug) self.assertEqual(resp.data['versions'], [external_version.verbose_name]) core_trigger_build.assert_called_once_with( - force=True, project=self.project, version=external_version + force=True, project=self.project, + version=external_version, commit=self.commit ) self.assertTrue(external_version) @@ -963,7 +965,8 @@ def test_github_pull_request_reopened_event(self, trigger_build, core_trigger_bu self.assertEqual(resp.data['project'], self.project.slug) self.assertEqual(resp.data['versions'], [external_version.verbose_name]) core_trigger_build.assert_called_once_with( - force=True, project=self.project, version=external_version + force=True, project=self.project, + version=external_version, commit=self.commit ) self.assertTrue(external_version) @@ -1007,7 +1010,8 @@ def test_github_pull_request_synchronize_event(self, trigger_build, core_trigger self.assertEqual(resp.data['project'], self.project.slug) self.assertEqual(resp.data['versions'], [external_version.verbose_name]) core_trigger_build.assert_called_once_with( - force=True, project=self.project, version=external_version + force=True, project=self.project, + version=external_version, commit=self.commit ) # `synchronize` webhook event updated the identifier (commit hash) self.assertNotEqual(prev_identifier, external_version.identifier) diff --git a/readthedocs/rtd_tests/tests/test_config_integration.py b/readthedocs/rtd_tests/tests/test_config_integration.py index bdfa9e36b93..264965ac1dd 100644 --- a/readthedocs/rtd_tests/tests/test_config_integration.py +++ b/readthedocs/rtd_tests/tests/test_config_integration.py @@ -371,8 +371,7 @@ def get_update_docs_task(self): build={ 'id': 99, 'state': BUILD_STATE_TRIGGERED, - 'commit': 'abc859dada4faf' - } + }, ) return update_docs diff --git a/readthedocs/rtd_tests/tests/test_core_utils.py b/readthedocs/rtd_tests/tests/test_core_utils.py index 26205fbd160..813acc91907 100644 --- a/readthedocs/rtd_tests/tests/test_core_utils.py +++ b/readthedocs/rtd_tests/tests/test_core_utils.py @@ -52,6 +52,7 @@ def test_trigger_build_when_version_not_provided_default_version_exist(self, upd 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } update_docs_task.signature.assert_called_with( @@ -74,6 +75,7 @@ def test_trigger_build_when_version_not_provided_default_version_doesnt_exist(se 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } update_docs_task.signature.assert_called_with( @@ -92,6 +94,7 @@ def test_trigger_custom_queue(self, update_docs): 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } options = { 'queue': 'build03', @@ -113,6 +116,7 @@ def test_trigger_build_time_limit(self, update_docs): 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } options = { 'queue': mock.ANY, @@ -135,6 +139,7 @@ def test_trigger_build_invalid_time_limit(self, update_docs): 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } options = { 'queue': mock.ANY, @@ -157,6 +162,7 @@ def test_trigger_build_rounded_time_limit(self, update_docs): 'record': True, 'force': False, 'build_pk': mock.ANY, + 'commit': None } options = { 'queue': mock.ANY, From cc607b9ae5811df7ddf2a5b5e3bab5c00b206d52 Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Fri, 26 Jul 2019 15:35:04 +0600 Subject: [PATCH 4/6] pass commit everywhere --- readthedocs/projects/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 954b8c39d76..6f24431015e 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -147,7 +147,8 @@ def sync_repo(self): version_repo = self.get_vcs_repo() version_repo.update() self.sync_versions(version_repo) - version_repo.checkout(self.version.identifier) + identifier = self.commit or self.version.identifier + version_repo.checkout(identifier) finally: after_vcs.send(sender=self.version) @@ -685,7 +686,7 @@ def setup_vcs(self): # Re raise the exception to stop the build at this point raise - commit = self.project.vcs_repo(self.version.slug).commit + commit = self.commit or self.project.vcs_repo(self.version.slug).commit if commit: self.build['commit'] = commit From 4f5754450f290a69c38cff94ca91ab66c526f699 Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Fri, 26 Jul 2019 20:25:39 +0600 Subject: [PATCH 5/6] paas commit while creating build object --- readthedocs/core/utils/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/readthedocs/core/utils/__init__.py b/readthedocs/core/utils/__init__.py index aa6696d125c..b06a5f7755c 100644 --- a/readthedocs/core/utils/__init__.py +++ b/readthedocs/core/utils/__init__.py @@ -114,6 +114,7 @@ def prepare_build( type='html', state=BUILD_STATE_TRIGGERED, success=True, + commit=commit ) kwargs['build_pk'] = build.pk From 8c70f2a2a8c2d9c2c91c0ded3088be36475cd123 Mon Sep 17 00:00:00 2001 From: saadmk11 Date: Wed, 31 Jul 2019 16:10:09 +0600 Subject: [PATCH 6/6] pass local variable identifier to checkout --- readthedocs/projects/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 671829353a6..f163bdb9053 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -146,7 +146,7 @@ def sync_repo(self): version_repo.update() self.sync_versions(version_repo) identifier = self.commit or self.version.identifier - version_repo.checkout(self.version.identifier) + version_repo.checkout(identifier) def sync_versions(self, version_repo): """