-
-
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: Bug in target_url
, failure to add "success" status if no external version exists
#10369
Conversation
ff5ba88
to
8908d26
Compare
8908d26
to
1b1d9fe
Compare
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.
Looks good with some changes 👍🏼
I'm concern about breaking the API of get_absolute_url
method since there are other places in our code that are expecting it to return without the scheme and domain, just the full path. We should add the scheme and domain from where we are calling this method inside GitHub and GitLab integrations instead of inside get_absolute_url
.
# select the correct state and description. | ||
github_build_state = SELECT_BUILD_STATUS[status]["github"] | ||
# select the correct status and description. | ||
github_build_status = SELECT_BUILD_STATUS[status]["github"] |
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.
I'm not sure that the rename of the state
to status
helps here. We call it status
in some places and GitHub calls it state
. Probably makes sense to keep consistency in our code, tho 👍🏼
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.
I have changed this because this is definitely about status. GitHub also calls it status AFAICT? https://docs.github.com/en/rest/commits/statuses?apiVersion=2022-11-28
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.
We are sending state
in the data we send to them.
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.
No, we're sending the status :) I know that it's meaningless to talk about a real difference between these two words, but I think we only use "state" to refer to "build state" and everything else is "status".
I think that clearly when it's called SELECT_BUILD_STATUS[status]["github"]
, it is correct to call the variable github_build_status
and it did make me less confused after I renamed it :)
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.
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.
Ah okay, my brain thinks about "GitHub commit status" - but I can see they called a field in the API "state", perhaps it was to avoid mixing it up with HTTP status. I think we should try to simplify our terminology rule to saying that we have "build state" for the Build objects internal naming of states - and then we have status for everything else. And then imagining a better future, we do a refactor to stop calling it "Build state" and call that "Build status" as well, so everything is "status" and we don't have "state" suddenly pop up and cause confusion :)
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.
Looks good! Thanks for taking care of this and doing the required work! 💪🏼
There are still issues with build skipping. I think it's related to PRs with only 1 commit. Will reopen the issue related to this change. |
Example: #10393 |
Fixes #10364
Reviewing
Nothing complicated here, the bug is very obvious: GitHub (and probably also GitLab) failed our API calls because we set a
target_url
liketarget_url=/dashboard/test-builds2/version/2102/edit/
and GitHub said:target_url must use http(s) scheme
I added information to our logs that helped resolve this issue.
Curious case
Notice this line in the changeset:
if not self.built and not self.uploaded
This was the reason why SOME PRs had "success ✔️" while PRs where the FIRST commit was supposed to be skipped got "pending 🟡" forever.
I haven't changed this, I think it's fine that a skipped build continues to link to the PR preview, otherwise it can confuse users that want to preview the build. Skipping a build is nice, but if it adds extra steps in review work, it will be annoying.
It is of course quite possible that we should open an issue about "Never skip the FIRST commit in a PR". But I think this is again a case of why we shouldn't leave this entire feature for the user to configure but make it an entirely build-in feature.
Q&A
This change is deployed in my local dev environment setup and runs side-by-side with the production env that reproduces the bug.
So this PR basically demonstrates it:
readthedocs/test-builds#2102
I had a look around the codebase for uses of
Version.get_absolute_url
and it's only used in ways that seem to have the correct output, i.e. does not prepend any additional https:// -- so we won't suddenly havehttps://domain/https://domain
or similar ✔️