jmongard / Git.SemVersioning.Gradle

Gradle plugin for automatically versioning a project using semantic versioning and conventional commits with change log support based on git commit messages.
https://plugins.gradle.org/plugin/com.github.jmongard.git-semver-plugin
Apache License 2.0
39 stars 4 forks source link

strange behavior printVersion #7

Closed driftertest closed 3 years ago

driftertest commented 3 years ago

Hi, sorry for my english. In my Jenkins pipeline i use docker image jdk:8u201 for building my app by gradle. And when i run printVersion after releaseVersion, module show me some strange (if you see, that the SHA of commit is same a81ff1f and latest tag is v0.3). If I do the same thing locally, then everything is fine. Where i make mistake?


+ ./gradlew printVersion
Downloading ...
.....................................................................................................................................
Welcome to Gradle 5.6!

Here are the highlights of this release:
 - Incremental Groovy compilation
 - Groovy compile avoidance
 - Test fixtures for Java projects
 - Manage plugin versions via settings script

For more details see https://docs.gradle.org/5.6/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set

> Task :printVersion
--------------------
Version: 0.3.1-SNAPSHOT+021.sha.a81ff1f

Finished: Fri Aug 06 14:52:55 MSK 2021

BUILD SUCCESSFUL in 8s
1 actionable task: 1 executed
[Pipeline] sh
+ cd /app
+ ./gradlew releaseVersion --no-dirty --no-commit --message 'Release tag set by user'
> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set

> Task :releaseVersion

Finished: Fri Aug 06 14:52:56 MSK 2021

BUILD SUCCESSFUL in 707ms
1 actionable task: 1 executed
[Pipeline] sh
+ cd /app
+ ./gradlew printVersion
> Configure project :
'lombok.addLombokGeneratedAnnotation = true' is not configured for '/app/src/main/java' of the main source-set

> Task :printVersion
--------------------
Version: 0.3.2-SNAPSHOT+sha.a81ff1f

Finished: Fri Aug 06 14:52:58 MSK 2021

BUILD SUCCESSFUL in 862ms
1 actionable task: 1 executed
jmongard commented 3 years ago

Hi, I guess you have some local modifications in the file system on the build server. You ignore these modifications when running the release task with --no-dirty Next time you run the the print version will detect these modifications again and add the SNAPSHOT suffix.

You could try setting the option noDirtyCheck = true in your build file to always ignore local modifications e.g.:

semver {
  noDirtyCheck = true
}

Or you could try to find out what is modified by running git status in your pipeline and then add those files/folders to your .gitignore file.

driftertest commented 3 years ago

thx, noDirtyCheck = true helped me.

driftertest commented 3 years ago

thx, noDirtyCheck = true helped me.