-
Notifications
You must be signed in to change notification settings - Fork 157
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
CurrentVersion is immediately SNAPSHOT after release #332
Comments
I am having that issue, too. |
After short analysis it seems, that the attribute |
@john-tipper would you mind, having a look? |
I suspect that this could have something to do with the way plugin is initialized. If I know that Gradle introduced mechanisms for lazy loading of properties some time ago, meaning (sorry for closing, it was a misclick) |
Not sure, if it's possible to access
I think I ran the Line 5 in 7202376
Still, the projectDirs of the Monorepo configuration were empty.
|
Uh, I was hoping to make it lazy, but didn't start playing with it yet. Thanks for the info! I will try to experiment anyways, but with less hope :) |
Hi @adamdubiel - could you already find out more about the cause of this issue? |
I'm having the same issue in my project. It's open source so you could easily verify it yourself:
prints:
|
Thanks for providing this repo! I think I uncovered a serious problem introduced along with monorepo support. This should have been tested by me :/ FYI @john-tipper @sradi it seems like monorepo support feature toggle is needed after all. Without it calculating any multimodule project version works in monorepo mode. I added integration test for this case and need to think of a solution. So far I think that some kind of |
+1 for the monorepo feature toggle. I got bitten by this as well (f4lco/libyear-gradle-plugin@ba7cba7). To paraphrase:
If I want to release, and the last change for this feature set touched the top-level README, the Gradle project in a separate folder will have a |
This issue is a blocker for anyone wanting to use this plugin when they have a multi gradle project monorepo. When a release for a subproject tags the repo it tags the most recent commit in the monorepo with the release regardless of what project it is from. However when it is trying to derive the current version for a subproject, if the most recent commit is in the root project or any other sub project then it will think it is ahead of the commit on the latest released tag when it is actually behind it. As pointed out by the first poster boolean onCommitWithLatestChange = currentVersionInfo.commit == latestChangePosition.revision is going to be false. currentVersionInfo will likely be a commit to a different project. The latestChangePosition is the latest commit to the current subproject. This needs to be changed to something like: is latestChangePosition ahead of the most recent commit with a tag matching the pattern. It should be noted that this wasn't an issue for multi gradle project monorepos before monorepo support was added in 1.11.0. However an important part of the monorepo support was the change to allow subprojects to be prefixes of each other in tags. This only came in 1.11.0. It would be really nice if this change was patched to 1.10.0 as a temporary solution. #307. I'm brand new to this project so I'm not sure who to ask to do that @bgalek / @adamdubiel ? I would be interesting in trying to fix the core issue in 1.12.1 if I have time this week. |
Hi @adamdubiel, |
@tjuszczyk master snapshot already supports gradle 7.x, yet as I understand this issue the behaviour of latest versions are different then old ones |
Hi @bgalek |
Is there an estimate for a fix for this? @bgalek @adamdubiel |
I think I might have been able to solve this with the new version with a workaround, invoking allprojects {
...
scmVersion {
tag.prefix = "${project.name}-"
monorepos {
projectDirs = project.getRootProject().subprojects.collect({p -> relativePath(p.projectDir.path)})
}
versionCreator 'versionWithBranch'
}
...
} and in each project: scmVersion.getMonorepoConfig().projectDirs // To fix the lazy load of version
project.version = scmVersion.version |
I have the same monorepo use case and am faced with the same issue as OP. It is a serious blocker for using this excellent plugin. Would be grateful if someone knowledgeable / dev team can comment on any workarounds that are confirmed to work and plan for a fix. Note that I tried the workaround suggested by @shashken but it did not work. |
I get flaky results now with the workaround I suggested, I noticed that when I'm doing normal merge (not squash commits) it does not detect the version and I get a snapshot (straight after a release like OP suggested) lastCommit = jgitRepository.log().setMaxCount(1).addPath(unixStylePath).call().iterator().next(); The problem there as I understood it is that addPath causes the git tree search to ignore the latest commit (the merge to master) and find the last commit in the subtree as the latest one, this causes the tag (that is on the proper commit) to be different from the latest commit found for the path and for the version to be detected as snapshot. (saw all this when I attached a debugger to the run of the plugin)
|
I would be willing to help. I dont know the axion code base but know
groovy. How can I help? A place to start would be to summarize what we know.
…On Sun, Oct 3, 2021, 11:16 AM shashken ***@***.***> wrote:
I get flaky results now with the workaround I suggested, I noticed that
when I'm doing normal merge (not squash commits) it does not detect the
version and I get a snapshot (straight after a release like OP suggested)
Now when I looked into this I saw that this line might cause the problems:
lastCommit = jgitRepository.log().setMaxCount(1).addPath(unixStylePath).call().iterator().next();
The problem there as I understood it is that addPath causes the git tree
search to ignore the latest commit (the merge to master) and find the last
commit in the subtree as the latest one, this causes the tag (that is on
the proper commit) to be different from the latest commit found for the
path and for the version to be detected as snapshot. (saw all this when I
attached a debugger to the run of the plugin)
- Note that im not 100% about this, my groovy is pretty bad and i
never commited to this repo, just found it thought it was awesome and
wanted to use it. Please if there is a maintainer here that can help us it
would be awesome! @farrukhnajmi <https://github.com/farrukhnajmi>
@bgalek <https://github.com/bgalek>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#332 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPCPN5PZLQSNUC6HHW5NUDUFBXVNANCNFSM4MQUXMTA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hi all! First of all we need a test specifying the behavior, then we can try to fix it. @shashken @farrukhnajmi I'll be happy to review the changes if you start a PR :) |
Are there concrete plans as to when a fixed version will be available? |
@marclohrer I have a solution for this problem at #422 @bgalek said there that we might be able to merge today. buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath files('/path/to/axion-release-plugin-1.13.4-full_monorepo_support-SNAPSHOT.jar')
}
}
...
apply plugin: 'pl.allegro.tech.build.axion-release' |
@shashken Thanks for the quick answer. I gave it a try as you proposed but failed badly when instantiating the plugin.
I'm sure I miss something obvious, but if you intend to release the fix soon now I'm happy to wait for the release. |
Yes, I'lm reviewiewing all changes in this release and I'm going to publish it today! |
@bgalek Thanks for the quick release. However something fundamental seems broken.
Now any gradle task fails with this error:
What am I missing? Only the new 1.13.4 version shows this problem. |
Those doesn't seem related to the change I made, maybe #425 . |
@marclohrer yes, I'll fix it ASAP, I'll also need to think a way to test it cross gradle version ;( |
https://github.com/allegro/axion-release-plugin/releases/tag/v1.13.5 fixed backward compability |
@bgalek Confirmed, 1.13.5 works now with gradle6. Thanks for the quick fix! |
Hi, I have a git repository, monorepo, hosting many independent projects. Each projects pulls in
axion-release-plugin
configures is prefixTag and does it's own release cycles.The release process is essentialy 1.) check the build, 2) release, 3) build deployable artifact for released version. This process relies on the fact that if
cV
is e.g.1.0.1-SNAPSHOT
then right after release it will be1.0.1
, therefore, without snapshot.This works fine up to axion v
1.10.3
. In v1.11.0
it breaks. After release, thecV
for the above gives1.0.2-SNAPSHOT
. I think the change is introduced here: 7202376In
VersionResolver
theScmPosition position = repository.currentPosition()
is changed tolatestChangePosition = repository.positionOfLastChangeIn(projectRootRelativePath, versionRules.monorepoProperties.dirsToExclude)
In case of multiple coexisting projects, it is very likely to not to be on the last change for project for which release is being done (something merged to master between merge of a project and invoking a release). Then
boolean onCommitWithLatestChange = currentVersionInfo.commit == latestChangePosition.revision
is going to befalse
and this will setVersionInfo.onReleaseTag
tofalse
and leads toisSnapshot
.If my conclusion is correct, then how do I get the correct release version (non snapshot) right after performing a release?
The text was updated successfully, but these errors were encountered: