-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: skip checkout step when building latest without an explicit default branch #10927
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good change... this is mostly just to fix the issue where people change their default branch and get stuck (eg. master -> main
)?
# Update the latest version to point to the current default branch | ||
# if the project doesn't have a default branch set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Update the latest version to point to the current default branch | |
# if the project doesn't have a default branch set. | |
# Update the latest version to point to the current VCS default branch | |
# if the project doesn't have an explicit default branch set. |
is_rtd_latest = ( | ||
self.verbose_name == LATEST_VERBOSE_NAME and self.version_machine | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is repeated 5 times in this PR... should it just be a method on self
here, so that we don't have it defined in different ways?
cmd = ["git", "symbolic-ref", "--short", "refs/remotes/origin/HEAD"] | ||
_, stdout, _ = self.run(*cmd, demux=True, record=False) | ||
default_branch = stdout.strip().removeprefix("origin/") | ||
return default_branch or self.fallback_branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we not have a default_branch
here?
Is this PR still relevant? I'm not sure to understand exactly what problem does it solves and how many users are affected by this. My feeling with this is that each time we touch the code on how we clone the versions we break someones' pattern 🙃 --so I'd be a little conservative here if it doesn't affect too many users. |
This is still valid. This solves the problem when people change their default branch, or when they manually import a project without having a default branch set explicitly. |
So, first I was trying to fix the whole webhook/build out of sync with latest, but there are several parts where default branch is set to work in some way, bogus way sometimes, but anyway. Instead of trying to solve the whole thing right now, I'm just doing two things:
The second change probably makes updating the default branch from the webhook useless. We should probably invest a little more of time on re-structuring how latest works and how we keep it in sync, for now I just want to unblock users importing projects manually without an explicit default branch.
There's still the problem about latest's identifier being out of sync when the default branch changes, but that's fixed after a new build, and this isn't a new problem, as it's present in the current implementation (and now users aren't blocked at least), and changing the default branch of a repo isn't something users do that often, so I think we are okay with that for now.
Extra fixes:
--
to end positional arguments in all git commands, this isn't a security issue, as all the git commands are run inside docker.Closes #10915