researchgate / gradle-release

gradle-release is a plugin for providing a Maven-like release process for projects using Gradle
MIT License
863 stars 223 forks source link

'createReleaseTag should throw exception when tag exist' fails if system language is other than English #300

Open martinm82 opened 5 years ago

martinm82 commented 5 years ago

Versions:

Problem: When running the tests with ./gradlew check I constantly hit a failure in the createReleaseTag should throw exception when tag exist in net.researchgate.release.GitReleasePluginCreateReleaseTagTests.

This happens only on macOS while running the tests in a Docker environment (docker run -u $(id -u) --rm -it -v $(pwd):$(pwd) -w $(pwd) openjdk:8u212-jdk-stretch ./gradlew check passed successfully.

07:48:46.294 [Test worker] DEBUG o.g.a.i.t.e.ExecuteActionsTaskExecuter - Executing actions for task ':createReleaseTag'.
07:48:46.294 [Test worker] INFO  org.gradle.api.Project - Running [git, branch, --no-color] in [/Users/migasiew/workspace/git/github/gradle-release/build/tmp/test/GitReleasePluginCreateReleaseTagTests/local]
07:48:46.311 [Test worker] INFO  org.gradle.api.Project - Running [git, branch, --no-color] produced output: [* master]
07:48:46.312 [Test worker] INFO  org.gradle.api.Project - Running [git, tag, -a, 1.2, -m, [Gradle Release Plugin] - creating tag:  '1.2'.] in [/Users/migasiew/workspace/git/github/gradle-release/build/tmp/test/GitReleasePluginCreateReleaseTagTests/local]
07:48:46.327 [Test worker] INFO  org.gradle.api.Project - Running [git, tag, -a, 1.2, -m, [Gradle Release Plugin] - creating tag:  '1.2'.] produced output: []
07:48:46.327 [Test worker] WARN  org.gradle.api.Project - Running [git, tag, -a, 1.2, -m, [Gradle Release Plugin] - creating tag:  '1.2'.] produced an error: [fatal: Tag '1.2' existiert bereits]
07:48:46.328 [Test worker] INFO  org.gradle.api.Project - Running [git, remote] in [/Users/migasiew/workspace/git/github/gradle-release/build/tmp/test/GitReleasePluginCreateReleaseTagTests/local]
07:48:46.344 [Test worker] INFO  org.gradle.api.Project - Running [git, remote] produced output: [origin]
07:48:46.344 [Test worker] INFO  org.gradle.api.Project - Running [git, push, --porcelain, origin, 1.2] in [/Users/migasiew/workspace/git/github/gradle-release/build/tmp/test/GitReleasePluginCreateReleaseTagTests/local]
07:48:46.422 [Test worker] INFO  org.gradle.api.Project - Running [git, push, --porcelain, origin, 1.2] produced output: [To /Users/migasiew/workspace/git/github/gradle-release/build/tmp/test/GitReleasePluginCreateReleaseTagTests/remote
*   refs/tags/1.2:refs/tags/1.2 [new tag]
Done]

Solution/Workaround:

After some digging in the logs and code I saw that the error message spit out by git was in my local language (German):

07:48:46.327 [Test worker] WARN  org.gradle.api.Project - Running [git, tag, -a, 1.2, -m, [Gradle Release Plugin] - creating tag:  '1.2'.] produced an error: [fatal: Tag '1.2' existiert bereits]

As can be seen in GitAdapter.groovy the code checks only for the English error message.

Even though my primary OS language is English it still was using German. Setting the following env variable fixed the issue:

LANG=en_US.UTF-8

You can close this ticket in case it is not an issue but I wanted to share it in case someone would hit the same problem.

Hillkorn commented 5 years ago

Thanks for reporting :)