You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Git backend: make default_branch to point to VCS' default branch (#9424)
* Git backend: make `defaul_branch` to point to VCS' default branch
Currently, importing a project manually without setting the `default_branch`,
will make Git VCS to use `master` as the default branch. However, with the last
swap about `master` and `main` branches, repositories defaulting to `main`
branch fail when being imported on Read the Docs. Leaving the user in a blocked
state they can get out.
This commit allows `Version.identifier` to be NULL meaning that "it won't try to
guess what's the default branch of the VCS" and just leave the repository in the
immediate state after being cloned (which is already the default branch). To do
this, I'm removing the command `git checkout --force <branch>` from the steps
executed for this case.
Closes#9367
* Git backend: use `default_branch` to decide whether build latest
Use `default_branch` coming from the Webhook itself to decide if a build for
Latest Version with `identifier=None` has to be triggered or not.
Note that this feature only works for GitHub and GitLab since Bitbucket does not
send the `default_branch` of the repository.
* Update `Version.identifier` based on VCS's `default_branch`
The VCS's `default_branch` comes in the incoming webhooks that GitHub and GitLab
sends to us when the user realizes an action in the repository.
Note that in this commit BitBucket is not supported and will keep having the
issues this PR solves. To solve this problem, we would need to update the
`Version.identifier` from the builder immediately after clonning the default
branch (e.g. `git clone <URL>`). I put some commented code/ideas in place to
come back to this once we feel it's the right time.
* Migrations dependencies
* Lint
* Add note about how to expand use cases for this command
* Revert "Add note about how to expand use cases for this command"
Meh, I made a mistake. This commit should have gone to a different branch.
This reverts commit fc90d36.
* Apply suggestions from code review
Co-authored-by: Eric Holscher <[email protected]>
* Typo
* TODO comment to potentially remove `identifier` from STABLE
* Tests: adjust our tests to match the new changes
* Lint
* Webhooks: add support for `default_branch` in generic webhooks
People is able to pass `default_branch=main` so Read the Docs can decide whether
or not it has to trigger a build for `LATEST` in case its `identifier=None` (the
default branch of the repository)
* Tests: define `default_branch="master"`
All these tests are expecting `master` to be the default branch.
We have to force this now since it was automatically "guess" previously,
but now we are not guessing anymore.
* Tests: remove `allow_deprecated_webhooks` from this check
I don't understand why we were checking for this in this test,
but I think it's not necessary since it's an old feature.
* Docs: mention it's optional
* Test: this feature flag is required
I removed because executing tests with `--nomigrations` made it fail.
Co-authored-by: Eric Holscher <[email protected]>
0 commit comments