Skip to content

Merge to the master triggers stable builds (two!) #8992

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

Closed
skirpichev opened this issue Mar 3, 2022 · 19 comments · Fixed by #9017
Closed

Merge to the master triggers stable builds (two!) #8992

skirpichev opened this issue Mar 3, 2022 · 19 comments · Fixed by #9017
Labels
Accepted Accepted issue on our roadmap Bug A bug

Comments

@skirpichev
Copy link
Contributor

skirpichev commented Mar 3, 2022

See recent https://readthedocs.org/projects/diofant/builds/, e.g. this build. Note, that the merge commit was tagged as v0.14.0a1. I wouldn't expect any stable build (which is v0.13.0 tag) at all in this situation...

@humitos
Copy link
Member

humitos commented Mar 3, 2022

I think our code may be confusing an alpha version, v0.14.0a1, like the stable version. However, the package we use follows PEP440 (https://www.python.org/dev/peps/pep-0440/#pre-release-spelling) and this should not be interpreted as a stable version.

We will need to reproduce this issue and debug a little more to find out where this is happening.

@humitos humitos added Accepted Accepted issue on our roadmap Improvement Minor improvement to code Needed: replication Bug replication is required labels Mar 3, 2022
@skirpichev
Copy link
Contributor Author

this should not be interpreted as a stable version

It seems, it wasn't before. Last time, I think, the pre-release tag was v0.13.0a4. There is no stable build for this tag, unless I miss something.

@stsewd
Copy link
Member

stsewd commented Mar 3, 2022

Note, that the merge commit was tagged as v0.14.0a1. I wouldn't expect any stable build (which is v0.13.0 tag) at all in this situation...

I don't see any v0.14 tags on your repo, and the build you linked (https://readthedocs.org/projects/diofant/builds/16251615/) says it built from diofant/diofant@92766cf, which is the v0.13.0 tag.

@skirpichev
Copy link
Contributor Author

I don't see any v0.14 tags on your repo

Yes. Sorry, but the tag v0.14.0a1 was removed (somehow automated release creation was broken).

says it built from diofant/diofant@92766cf, which is the v0.13.0 tag.

That's correct. But that build apparently was triggered by pushing the a1 tag. (The merge commit has same time as pair of stable builds.)

@skirpichev
Copy link
Contributor Author

@stsewd, just another example: pushing tag v0.14.0a2 produces two failing builds (1, 2).

@humitos
Copy link
Member

humitos commented Mar 7, 2022

@skirpichev I'm not sure what's the problem yet, but definitely something weird is happening here. Note that the second build you linked, https://readthedocs.org/projects/diofant/builds/16279777/, shows two different commits on the same page:

Screenshot_2022-03-07_10-31-07

Those commits should match. That probably comes the confusion of the two builds.

@skirpichev
Copy link
Contributor Author

92766cf922e83185079b4411dfa633d7ed338dff - the merge
92bba0c66e73c13903c28538b234155b6caaffdf - tag v0.13.0 (for the above merge commit)

I don't know why the rtd shows the tag sha in the build log, but the main problem (in my opinion) is that the stable build is triggered. It shouldn't.

@krassowski
Copy link

I am not sure if related, but for some time now every single push to any pull request (and possibly to master too?) generates dozens of builds for me on https://readthedocs.org/projects/jupyterlab-lsp/ across versions, which leads to dozens of spam mails about failures and to running out of the concurrent job limit which leads to more failures. I don't think that push should trigger re-building of all versions. Is this connected, or should I open a new issue?

@stsewd
Copy link
Member

stsewd commented Mar 9, 2022

I'll try to debug this a little more and see if they are related.

@stsewd
Copy link
Member

stsewd commented Mar 15, 2022

I took a look at this today.

For https://readthedocs.org/projects/diofant/, looks like you created the github webhook "manually" (without connecting your account), and it's subscribed to push and create events (since rtd didn't create the webhook, it doesn't know that the webhook is subscribed to both events), and both events are triggered when a branch/tag is created, that triggers two "syncs". And for some reason, each sync operation is triggering a build to stable. You should be able to reduce the trigger of one stable by removing the "create" events from your webhook on github. Why does it trigger a build to stable? Looks like the tags are being re-created, that makes it appear like a new stable version was created, you can see this at https://readthedocs.org/projects/diofant/versions/ where there are a lot of tags suffixed with a letter (this happens when there are more than 1 version with the same name).

For https://readthedocs.org/projects/jupyterlab-lsp/, looks like you have an automation rule that enables all new created tags, and for some reason, tags are being re-created, so the rule is activating each tag, you can see this at https://readthedocs.org/projects/jupyterlab-lsp/versions/ where there are a lot of versions activated, and they are suffixed with a letter (this happens when there are more than 1 version with the same name).

Both problems point to something wrong with our "sync versions" code, and that is re-creating the tags (doesn't look like it duplicates the branches).

@stsewd stsewd added Bug A bug and removed Improvement Minor improvement to code labels Mar 15, 2022
@skirpichev
Copy link
Contributor Author

looks like you created the github webhook "manually" (without connecting your account)

(I doubt it so. But this hook was created long time ago and I can't refute your guess...)

Well, that I did right now: 1) webhook on the GH - was removed 2) same for GH integration of the RTD 3) I did set up the GH incoming webhook again. For some reasons I see now "The project diofant doesn't have a valid webhook set up, commits won't trigger new builds for this project. See the project integrations for more information." Not sure what this means: I did everything on the suggested docs page section (Integration Creation) and it seems the webhook was created on the GH side (with the correct URL, etc). UPD: after several minutes this message disappeared.

You should be able to reduce the trigger of one stable by removing the "create" events from your webhook on github.

@stsewd, Well, did an alpha release again. There are two stable builds again: 1st and 2nd.

Looks like the tags are being re-created, that makes it appear like a new stable version was created, you can see this at https://readthedocs.org/projects/diofant/versions/ where there are a lot of tags suffixed with a letter (this happens when there are more than 1 version with the same name).

Hmm, could you point to some specific wrong example on that page? All these mentioned tags (v0.1.2 and v0.1.2a3 like) are correct, describe unique versions (conforming PEP 440; "v" - is a common prefix for GH tags). Also, most tags (i.e. latest ones v0.14.0a3, etc) are signed by my GPG key. Do you mean that there is some internal to the RTD notion of "tag" (not same as the git tag), which was re-created?

@stsewd
Copy link
Member

stsewd commented Mar 15, 2022

Do you mean that there is some internal to the RTD notion of "tag" (not same as the git tag), which was re-created?

Yes, rtd versions, not your repo versions (which are mapped to rtd versions). But looks like I got confused, you do have tags that have letters as suffix.

@skirpichev
Copy link
Contributor Author

you do have tags that have letters as suffix

Yep, it's PEP 440.

@stsewd
Copy link
Member

stsewd commented Mar 15, 2022

Found the problem. This is because git-python returns the hash of the "bare" tag, but when using git ls-remote we are taking the hash of the annotated tag. That mismatch on the hash makes it look like the version was updated, so we are re-building it.

We are using git-python when doing a full build, and ls-remote when doing a sync.

@stsewd
Copy link
Member

stsewd commented Mar 15, 2022

https://readthedocs.org/projects/jupyterlab-lsp/ doesn't have annotated tags, so I'm still checking what's happening there.

stsewd added a commit that referenced this issue Mar 15, 2022
If two versions share the same verbose name
(a branch named 2.0 and a tag named 2.0),
then we will be updating both,
instead of just one and changing its type from branch to tag.
Later when running this same code,
it will see the branch as new, since isn't included in our queryset that
filters by type=branch.

This wasn't happening before because this check was true
https://github.com/readthedocs/readthedocs.org/blob/2e3f208c4906de649a9b5b9e33afee6cc20b86bc/readthedocs/api/v2/utils.py#L74-L74

Since a branch would never change its identifier
(origin/name), but once lsremote was enabled,
the identifier didn't included the 'origin/' part.

So, when doing a full build the branches would be changed
to (origin/name) and when doing a syn they would be changed
to (name), and so on.

Ref #8992 (comment)
@krassowski
Copy link

Some context on jupyterlab-lsp repo:

@stsewd
Copy link
Member

stsewd commented Mar 16, 2022

Found the problem for that one, it's related to the same problem. #9019, wa may just disable the "lsremote" feature while we fix the issues.

@humitos humitos removed the Needed: replication Bug replication is required label Mar 16, 2022
@stsewd
Copy link
Member

stsewd commented Mar 16, 2022

I have disabled the lsremote feature till we fix it, you should no longer experiment these problems (could take effect after one resync/build, depending on the state the versions were).

@krassowski let me know if you want me to deactivate all those versions created with a letter prefix for you.

stsewd added a commit that referenced this issue Apr 6, 2022
* Sync versions: filter by type on update

If two versions share the same verbose name
(a branch named 2.0 and a tag named 2.0),
then we will be updating both,
instead of just one and changing its type from branch to tag.
Later when running this same code,
it will see the branch as new, since isn't included in our queryset that
filters by type=branch.

This wasn't happening before because this check was true
https://github.com/readthedocs/readthedocs.org/blob/2e3f208c4906de649a9b5b9e33afee6cc20b86bc/readthedocs/api/v2/utils.py#L74-L74

Since a branch would never change its identifier
(origin/name), but once lsremote was enabled,
the identifier didn't included the 'origin/' part.

So, when doing a full build the branches would be changed
to (origin/name) and when doing a syn they would be changed
to (name), and so on.

Ref #8992 (comment)

Don't use the origin/ part for branches,
it's redundant as we always have only one remote (origin),
and we need to match the same behavior of lsremote.
@stsewd
Copy link
Member

stsewd commented Apr 12, 2022

We have enabled back the lsremote feature, everything should be fixed now, but let us know if the problems are back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants