Skip to content
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

Wrong version being reported #63

Closed
Silvanoc opened this issue May 16, 2023 · 9 comments
Closed

Wrong version being reported #63

Silvanoc opened this issue May 16, 2023 · 9 comments
Milestone

Comments

@Silvanoc
Copy link

Using dunamai to obtain the last tag of project LinkML doesn't work correctly on a GitLab pipeline (locally runs as expected, even when using the same container image being used in the pipeline).

I'm letting git tag show me all the tags sorted (--sort) by all the possible keys and the result is always the same (1.5.2.xyz as of now). But when I use dunamai from git to get that version I obtain 1.5.0.xyz 😮.

I've already checked that the tags are annotated and that the initial commit is not tagged and empty.

I can reproduce it, but only in the pipeline, therefore debugging is a bit cumbersome... Any hints on how to diagnose the issue?

@Silvanoc
Copy link
Author

The topological ordering of the log is responsible for it. Don't ask me why it's ordering differently on the pipeline than locally (using the same container and therefore the same git version).

@Silvanoc
Copy link
Author

I found out something more. A branch that was created from a commit following v1.5.0 (before v1.5.1) has been merged after v1.5.2 and git log --topo-order appears to be taking that branch in the topological order instead of the main one that is being taken on my machine. Why?

It is a shallow clone, if I unshallow it, then it works!

IMO dunamai should report at least a warning (and should be added to the documentation) that due to some issues with git log --topo-order, dunamai might provide unexpected results.

@mtkennerly
Copy link
Owner

It is a shallow clone, if I unshallow it, then it works!

That can definitely cause unexpected output. For example, Gitlab defaults to a clone depth of 50, so if your last tag was over 50 commits ago, you'd end up with a version base of 0.0.0. I thought this was in the documentation already, but it doesn't seem to be, so I'll add a note.

@Silvanoc
Copy link
Author

git rev-parse --is-shallow-repository tells you if it's a shallow repository, dunamai could check it and report a warning.

@mtkennerly
Copy link
Owner

The next release will include an automatic check:

$ dunamai from git
Warning: This is a shallow repository, so Dunamai may not produce the correct version.
0.0.0.post8.dev0+8e8b1e1

$ echo $?
0

$ dunamai from git --strict
This is a shallow repository, so Dunamai may not produce the correct version.

$ echo $?
1

@Silvanoc
Copy link
Author

Will the poetry-dynamic-versioning option strict also result in the same check?

@mtkennerly
Copy link
Owner

mtkennerly commented May 19, 2023

Yes, it will :) poetry-dynamic-versioning will just need an update to show the warning, but the strict error will happen automatically.

@mtkennerly
Copy link
Owner

Dunamai v1.17.0 and poetry-dynamic-versioning v0.22.0 are out now and include these changes.

@Silvanoc
Copy link
Author

It's great how quickly you've addressed it! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants