{"action":"created","issue":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4450","repository_url":"https://api.github.com/repos/rtfd/readthedocs.org","labels_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4450/labels{/name}","comments_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4450/comments","events_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4450/events","html_url":"https://github.com/rtfd/readthedocs.org/issues/4450","id":345906483,"node_id":"MDU6SXNzdWUzNDU5MDY0ODM=","number":4450,"title":"Sync versions when creating a new branch/tag","user":{"login":"stsewd","id":4975310,"node_id":"MDQ6VXNlcjQ5NzUzMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/4975310?v=4","gravatar_id":"","url":"https://api.github.com/users/stsewd","html_url":"https://github.com/stsewd","followers_url":"https://api.github.com/users/stsewd/followers","following_url":"https://api.github.com/users/stsewd/following{/other_user}","gists_url":"https://api.github.com/users/stsewd/gists{/gist_id}","starred_url":"https://api.github.com/users/stsewd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stsewd/subscriptions","organizations_url":"https://api.github.com/users/stsewd/orgs","repos_url":"https://api.github.com/users/stsewd/repos","events_url":"https://api.github.com/users/stsewd/events{/privacy}","received_events_url":"https://api.github.com/users/stsewd/received_events","type":"User","site_admin":false},"labels":[{"id":959209528,"node_id":"MDU6TGFiZWw5NTkyMDk1Mjg=","url":"https://api.github.com/repos/rtfd/readthedocs.org/labels/Accepted","name":"Accepted","color":"10ff91","default":false},{"id":67523912,"node_id":"MDU6TGFiZWw2NzUyMzkxMg==","url":"https://api.github.com/repos/rtfd/readthedocs.org/labels/Feature","name":"Feature","color":"5319e7","default":false},{"id":221928881,"node_id":"MDU6TGFiZWwyMjE5Mjg4ODE=","url":"https://api.github.com/repos/rtfd/readthedocs.org/labels/Needed:%20design%20decision","name":"Needed: design decision","color":"54473F","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/milestones/21","html_url":"https://github.com/rtfd/readthedocs.org/milestone/21","labels_url":"https://api.github.com/repos/rtfd/readthedocs.org/milestones/21/labels","id":2916297,"node_id":"MDk6TWlsZXN0b25lMjkxNjI5Nw==","number":21,"title":"New build features","description":"New builder features, to help introduce better user experience into our building. This is secondary to builder stability, though there is some overlap in goals here.","creator":{"login":"agjohnson","id":1140183,"node_id":"MDQ6VXNlcjExNDAxODM=","avatar_url":"https://avatars0.githubusercontent.com/u/1140183?v=4","gravatar_id":"","url":"https://api.github.com/users/agjohnson","html_url":"https://github.com/agjohnson","followers_url":"https://api.github.com/users/agjohnson/followers","following_url":"https://api.github.com/users/agjohnson/following{/other_user}","gists_url":"https://api.github.com/users/agjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/agjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agjohnson/subscriptions","organizations_url":"https://api.github.com/users/agjohnson/orgs","repos_url":"https://api.github.com/users/agjohnson/repos","events_url":"https://api.github.com/users/agjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/agjohnson/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":1,"state":"open","created_at":"2017-11-16T07:18:33Z","updated_at":"2018-09-19T22:10:06Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2018-07-30T19:41:55Z","updated_at":"2018-11-01T12:18:46Z","closed_at":null,"author_association":"MEMBER","body":"Currently rtd doesn't detect if a branch/tag was deleted, we only detect if a commit was pushed to a branch or a tag was re-tagged. \r\n\r\nRef https://github.com/rtfd/readthedocs.org/issues/3192#issuecomment-408704631\r\n\r\n## Current status\r\n\r\n### GitHub\r\n\r\nWe only listen to push events for branch and tags in github https://developer.github.com/v3/activity/events/types/#pushevent. We can listen to Create and Delete events https://developer.github.com/v3/activity/events/types/#createevent https://developer.github.com/v3/activity/events/types/#deleteevent\r\n\r\n### GitLab\r\n\r\nWe only listen to push events which exclude tags https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#push-events. We can listen to tag events with https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#tag-events\r\n\r\nGitLab doesn't have a separate event for creation/deletion, instead, it sets the `before/after` field to `0000000000000000000000000000000000000000`\r\n\r\n### BitBucket\r\n\r\nWe currently listen to push events, it works for branches and tags https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push.\r\n\r\nBitBucket doesn't have a separate event for creation/deletion, instead, it sets the `new` attribute (null if it is a deletion) and the `old` attribute (null if it is a creation).\r\n\r\n## Solution\r\n\r\nFirst, we need to listen to (or modify) the above events to have the information about the creations and deletions. Our sync step is bound to a specific version (and it should exists in the database)\r\n\r\nhttps://github.com/rtfd/readthedocs.org/blob/b04b11298f5a45d6f6c6ec3f9bbbf368b942295b/readthedocs/projects/tasks.py#L223-L226\r\n\r\nSo, we can't call it directly, said that we have 2 options:\r\n\r\n1) Trigger a new build to the default branch\r\n\r\n2) Call to `SyncRepositoryTask` with the default branch\r\n\r\nhttps://github.com/rtfd/readthedocs.org/blob/b04b11298f5a45d6f6c6ec3f9bbbf368b942295b/readthedocs/projects/tasks.py#L223-L226\r\n\r\nIt doesn't trigger a new build, but clone the repo to the default branch and update the version list.\r\n\r\n## Conclusion\r\n\r\nThe changes for getting the information about new/removed branches and tags is relatively easy, but we need to take a decision about how to sync the versions, with 1) the user can see the build process and that _something is happening_, but we will be wasting resources building the documentation, with 2) we save resources but the user doesn't see anything (it can be checked in the webhook response  anyway)"},"comment":{"url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/comments/435023439","html_url":"https://github.com/rtfd/readthedocs.org/issues/4450#issuecomment-435023439","issue_url":"https://api.github.com/repos/rtfd/readthedocs.org/issues/4450","id":435023439,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTAyMzQzOQ==","user":{"login":"ericholscher","id":25510,"node_id":"MDQ6VXNlcjI1NTEw","avatar_url":"https://avatars2.githubusercontent.com/u/25510?v=4","gravatar_id":"","url":"https://api.github.com/users/ericholscher","html_url":"https://github.com/ericholscher","followers_url":"https://api.github.com/users/ericholscher/followers","following_url":"https://api.github.com/users/ericholscher/following{/other_user}","gists_url":"https://api.github.com/users/ericholscher/gists{/gist_id}","starred_url":"https://api.github.com/users/ericholscher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericholscher/subscriptions","organizations_url":"https://api.github.com/users/ericholscher/orgs","repos_url":"https://api.github.com/users/ericholscher/repos","events_url":"https://api.github.com/users/ericholscher/events{/privacy}","received_events_url":"https://api.github.com/users/ericholscher/received_events","type":"User","site_admin":false},"created_at":"2018-11-01T12:18:46Z","updated_at":"2018-11-01T12:18:46Z","author_association":"MEMBER","body":"> Call to SyncRepositoryTask with the default branch\r\n\r\nFeels like the right implementation. That was the general idea behind that bit of code to behind with, so we're mostly just expanding when it gets called to include `delete` events, I think?"}}
{"actor":{"display_login":"ericholscher"}}