knope-dev / knope

A command line tool to to handle all the tasks most developers find tedious.
https://knope.tech
MIT License
81 stars 8 forks source link

Bug: `Version` variable is inconsistent, and sometimes equal to the old version #1111

Open BatmanAoD opened 1 month ago

BatmanAoD commented 1 month ago

It appears that this is a bug introduced in either 0.16.1 or 0.16.2.

Here, I have several Command steps, some of which use the Version variable. I've used ... to elide some output. Note that with 0.16.0, the release-cli command uses v1.17.0, but with 0.16.2, the command uses v1.16.0.

$> knope --version
knope 0.16.0

$> knope release --verbose --dry-run
...
Using MINOR rule to bump from 1.16.0 to 1.17.0
...
Would run git commit -m "chore: prepare release 1.17.0"
Would create Git tag v1.17.0
Would create Git tag golang/v1.17.0
Would run git push --push-option ci.skip
Would run git push --tags --push-option ci.skip
Looking for Git tags matching package name.
Skipping relevant tags that are not on the current branch: v1.2.0, v1.17.0, v1.0.0-rc.1, v1.1.1
Finding version for ...
Found 1.17.0 from ...
... <the above is repeated for each versioned file>
Would run release-cli create --name "Release 1.17.0" --tag-name "v1.17.0" --ref "v1.17.0"

$> cargo binstall knope
 ...

$> knope --version
knope 0.16.2

$> knope release --verbose --dry-run
...
Using MINOR rule to bump from 1.16.0 to 1.17.0
...
Would run git commit -m "chore: prepare release 1.17.0"
Would create Git tag v1.17.0
Would create Git tag golang/v1.17.0
Would run git push --push-option ci.skip
Would run git push --tags --push-option ci.skip
Looking for Git tags matching package name.
Would run release-cli create --name "Release 1.16.0" --tag-name "v1.16.0" --ref "v1.16.0"

Also of interest, despite the --verbose flag, the second version-resolution doesn't actually print any output with 0.16.2, even though it does with 0.16.0.

dbanty commented 1 month ago

I've been doing a ton of refactoring of the version handling code to pull out a bunch of stuff into a standalone crate (so the bot can use it). I'm sure I broke something in all that.

Curious—does it pick the right version when actually running PrepareRelease? It might just be the --dry-run handling that got broken.

BatmanAoD commented 1 month ago

I'm not sure -- if I have some time I'll try to put together a standalone reproduction case.

BatmanAoD commented 1 month ago

Oh, but I think I did actually discover this when a release ran, rather than by doing a prerelease.

dbanty commented 1 month ago

@BatmanAoD 0.17 finally finishes all the refactor work I was doing in the 0.16 series. Did I happen to fix the version variable bug as part of that?