We are using the Bamboo build server to build our maven projects.
The build should continue to succeed after adding this plugin.
With this plugin the build fails.
Maven prints the following error:
[ERROR] Failed to execute goal pl.project13.maven:git-commit-id-plugin:2.2.4:revision (default) on project provided: Could not complete Mojo execution... java.net.URISyntaxException: Illegal character in authority at index 7: file://D:\[DIRECTORY]\_git-repositories-cache\c05bf5b346c29887ddbfdd9911f13aee6eeb63bb -> [Help 1]
This is because we are using the "Enable repository caching on remote agents" option for our git repository inside the Bamboo configuration. This produces the following entry within the .git/config:
[remote "origin"]
url = file://D:\\[DIRECTORY]\\_git-repositories-cache\\c05bf5b346c29887ddbfdd9911f13aee6eeb63bb
If we disable the caching option the build succeeds. Because the origin url points to file://nothing.
According to #258 this is an unsupported gitRemoteString and one should open another ticket for other formats. Is it possible to add this format too? Because we cannot alter the Bamboo behavior.
Hi,
thanks for reporting your issue here.
This different file handling and different prefixes are a pain in the a**.
Unfortunately since this is coming back over and over again (e.g. https://github.com/ktoso/maven-git-commit-id-plugin/issues/274) and I'm not even sure if we would be able to change this implementation. Based on our tests we basically want to only make sure that potential passwords used in http(s) remote urls are not exposed inside the properties (https://github.com/ktoso/maven-git-commit-id-plugin/blob/master/src/test/java/pl/project13/maven/git/UriUserInfoRemoverTest.java#L40). However our implementation (https://github.com/ktoso/maven-git-commit-id-plugin/blob/master/src/main/java/pl/project13/maven/git/GitDataProvider.java#L228) trys to do its magic for any other protocol as well.
Not sure if ftp would contain passwords as well....so one the one hand its a pain in the ass to always fix a border case with some quite popular software and on the other hand it doesn't make sense to use our logic for all protocols.
Changes I will implement during this ticket:
file:// (not listed on https://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS)I am feeling with you. Bamboo is buggy and lacks with many features which are not implemented for years. For us it is no show stopper and we just disable the caching - which for me is a nice option but not mandatory. But I wanted to report the case for other people maybe having this problem too and have not the option to disable it.
I do not know if you want to alter your regex from
^([a-zA-Z0-9_.+-])+@(.*)|^\\[([^\\]])+\\]:(.*)|^file:///(.*)
to
^([a-zA-Z0-9_.+-])+@(.*)|^\\[([^\\]])+\\]:(.*)|^file:/{2,3}(.*)
but this might be working without knowing anything else about your code.
But if it should work with your existing test case
{ "file:///C:\\Users\\test\\example", "file:///C:\\Users\\test\\example" }
and the new one from mine
{ "file://C:\\Users\\test\\example", "file://C:\\Users\\test\\example" }
Thanks in advance!
Yeah that would be pretty much one part of the fix for this issue.
One additional item I would like to change is the way that it doesn't kill the build process and simply returns an empty string if something broken (throwing the exception kills the build).
Plus one thing that will also be coming in the next release is selective running (https://github.com/ktoso/maven-git-commit-id-plugin/issues/185). If the remote url is not needed (might be filtered out in 90% since it might contain data from internal hosts that should not be exposed) this code should not be invoked and thus the build should not even fail or complain.
I believe this would make it way more stable and not throw this plugin over and over again in a situation where the build might be entirely broken and as a result this plugin gets removed....
Of course, not failing for such cases is a good solution - at least a workaround until a solution is found :-)
Integrated should be shipped with the upcomming 2.2.5 release.
Thanks for reporting it here :-)
You're welcome and thank you :-)
@TheSnoozer I ran into similar issue with SCP URL having username omitted, like "192.168.0.1:/path/project.git".
Instead of matching SCP URL with regex, I think it's better to prepend "ssh://" and try again on URISyntaxException.
I'm not quite sure why I assigned this issue the milestone 3.0
The general fix that the plugin now can deal with the broken bamboo string is integrated into 2.2.5, see https://github.com/git-commit-id/maven-git-commit-id-plugin/commit/91ee6a5b1ce0a1c06687d97ab733e07c171d79d0
And also the change that the plugin does not fail the build if it encounters a new broken string is also included in 2.2.5, see https://github.com/git-commit-id/maven-git-commit-id-plugin/commit/45520f21348fbbadfdfd992b594b86254cfea18f
Changing back to milestone 2.2.5....