Git tag info is not getting populated while executing the plugin in google cloud build using maven:3.6.3-openjdk-11.
I am trying to use the git properties generated by the plugin in maven build with <injectAllReactorProjects>true</injectAllReactorProjects> option.
The following info is getting populated -
git.branch
git.commit.id
git.commit.message
but the following are not getting populated only when it runs as a part of google cloud build
git.closest.tag.name
git.tags
but the above get populated when I run them locally.
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.2</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<useNativeGit>true</useNativeGit>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<injectAllReactorProjects>true</injectAllReactorProjects>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<gitDescribe>
<tags>true</tags>
</gitDescribe>
</configuration>
</plugin>
Is there a (public) project where this issue can be reproduced? If so please provide a link.
Unfortunately it's not a public project
Include any stack-traces or any error messages -
i don't see any error message
For reproducibility please provide the following:
java -version and also include details about oracle-jdk VS open-jdk) - openjdk11mvn --version) - 3.6.3lsb_release -a or cat /etc/*release*) - I think its linux; amd64- name: maven:3.6.3-openjdk-11
entrypoint: mvn
args: ["clean","package","-DgitTag=${TAG_NAME}","-DgoogleProjectId=${PROJECT_ID}","jib:build","--batch-mode","-DskipTests"]
volumes:
- path: '/cache/.m2'
name: 'm2_cache'
env:
- MAVEN_OPTS=-Dmaven.repo.local=/cache/.m2
id: 'mvn-jib-build'
- how maven is being executed (e.g. ``mvn clean deploy`` VS ``mvn deploy:deploy``)
mvn package
Hello,
thank you for creating an issue for this.
At first I somewhat suspected that this might be an issue with leightweight VS annotated tags, but that doesn't appear the issue in your case (since it's working on google cloud, but not locally).
Since you have the <useNativeGit>true</useNativeGit> setting enabled the plugin will be using the native git binary and to obtain the closest git-tag the plugin is running something along the lines of git describe HEAD --abbrev=0 --tags (see here. For the git tags-property the plugin would be running git tag --contains HEAD (see here).
Now do you get the same output when you run this locally VS on the cloud system? Do you use some mechanism that happens to create the tags in the cloned repo on the clound server, but perhaps doesn't publish them to the actual repo? Or in other words are the tags visible to the cloud build visible inside the git repo (e.g. via git show-ref --tags or git tag -l)? Do you perhaps have a shallow clone locally (e.g. git clone -鈥揹epth [depth] [remote-url] or git clone [remote-url] --branch [name] --single-branch [folder]?
Maybe that gives an already good indicator what might be going on.
Thanks a ton for replying to this - let me investigate that thoroughly and update here again.
Just curious: Have you discovered the root cause of this issue?
Since I haven't heard back, I'm going ahead and close this issue. if this is still an issue, please feel free to reopen.
Most helpful comment
Thanks a ton for replying to this - let me investigate that thoroughly and update here again.