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

Different Version Derived on Gitlab vs Local #233

Open
EarthCitizen opened this issue Dec 3, 2022 · 2 comments
Open

Different Version Derived on Gitlab vs Local #233

EarthCitizen opened this issue Dec 3, 2022 · 2 comments

Comments

@EarthCitizen
Copy link

Nebula release plugin version 16.1.0.
Gradle version 7.5.1.

Our project is on branch release/2.0.x, branched from tag v2.0.0.

When I run ./gradlew publish final from my local machine I get:

Inferred project: fun-project, version: 2.0.1

This is the correct and expected version.

In Gitlab, I have the following settings:

GIT_FETCH_EXTRA_FLAGS: --tags --prune --prune-tags
GIT_DEPTH: "0"

This, according to the Gitlab documentation, clones the full depth of the repo, and fetches tags.

And the tags are getting pulled because I can see this in the logs:

 * [new branch]      develop               -> origin/develop
 * [new branch]      master                -> origin/master
 * [new branch]      release/2.0.x         -> origin/release/2.0.x
 * [new tag]         v2.0.0                -> v2.0.0
 * [new tag]         v2.0.0-SNAPSHOT       -> v2.0.0-SNAPSHOT

As can be seen, the tag v2.0.0 comes in with the clone. But yet, when the final task runs on Gitlab, it derives the incorrect version:

Inferred project: fun-project, version: 2.1.0

This is the incorrect version per the previous tag and the current branch name.

@sourcedelica
Copy link

sourcedelica commented Jan 9, 2025

I'm running into the same thing, though it is intermittent. About 25% of the time nebula-release-plugin chooses to increment the minor version instead of the patch. This only happens in CI.

Here are some relevant log lines from the ./gradlew :currentVersion -q --debug log, when at HEAD of release-1.12.x there are two tags: v1.12.0 and v1.12.1. I am expecting the next version to be v1.12.2, but nebula-release-plugin is computing v1.13.0.

$ grep nebula build.log-v1.13.0
...
2025-01-09T18:06:19.833+0000 [INFO] [nebula.plugin.release.git.semver.SemVerStrategy] Using snapshot strategy because repo is not dirty (or allowed to be dirty) and stage (SNAPSHOT) is one of: [SNAPSHOT]
2025-01-09T18:06:19.846+0000 [INFO] [nebula.plugin.release.git.semver.SemVerStrategy] Beginning version inference using snapshot strategy and input scope (null) and stage (SNAPSHOT)
2025-01-09T18:06:19.848+0000 [DEBUG] [nebula.plugin.release.git.semver.NearestVersionLocator] Locate beginning on branch: HEAD
2025-01-09T18:06:19.946+0000 [DEBUG] [nebula.plugin.release.git.semver.NearestVersionLocator] Nearest release: {version=1.12.1, rev=commit 459697bbbf08b9c3cbcbc7ba0cafc7522d696cdc 1736445570 -----sp, distance=0}, nearest any: {version=1.12.1, rev=commit 459697bbbf08b9c3cbcbc7ba0cafc7522d696cdc 1736445570 -----sp, distance=0}.
2025-01-09T18:06:19.949+0000 [DEBUG] [nebula.plugin.release.git.semver.SemVerStrategy] Located nearest version: nebula.plugin.release.git.semver.NearestVersion(1.12.1, 1.12.1, 0, 0)
2025-01-09T18:06:20.059+0000 [WARN] [nebula.plugin.release.git.semver.SemVerStrategy] Inferred project: demo-cicd, version: 1.13.0-SNAPSHOT

I'm happy to provide more logs.

I'm using nebula-release-plugin 17.2.2 with Gradle 8.6 and JDK21.

@sourcedelica
Copy link

I found that if I force Gitlab to clone (don't reuse existing build directories) then I don't see the problem. In Gitlabese, that's GIT_STRATEGY=clone.

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