[SCICM-6923] read git information from git properties for java apps#35103
Merged
[SCICM-6923] read git information from git properties for java apps#35103
Conversation
Contributor
Preview links (active after the
|
wmouchere
approved these changes
Mar 9, 2026
| plugins { | ||
| id("org.springframework.boot") version "X.X.X" // required | ||
| // ... | ||
| id("com.gorylenko.gradle-git-properties") version "2.5.2" |
There was a problem hiding this comment.
Can we bump all of those to 2.5.7? No major changes, just to be up-to-date
Comment on lines
356
to
372
| ## Build inside a Docker container | ||
|
|
||
| If your build process is executed in CI within a Docker container, perform the following steps to ensure that the build can access Git information: | ||
|
|
||
| 1. Add the following text to your `.dockerignore` file. This ensures that the build process is able to access a subset of the `.git` folder, enabling it to determine the git commit hash and repository URL. | ||
|
|
||
| ``` | ||
| !.git/HEAD | ||
| !.git/config | ||
| !.git/refs | ||
| ``` | ||
|
|
||
| 2. Add the following line of code to your `Dockerfile`. Ensure that it is placed before the actual build is run. | ||
|
|
||
| ``` | ||
| COPY .git ./.git | ||
| ``` |
There was a problem hiding this comment.
I'm not sure why this section was here before. But now that we have plugins that need the full .git folder I don't think it's up to date.
We can recommend something like this:
Use a (named context)[https://docs.docker.com/build/concepts/context/#named-contexts] to access your .git folder at build time.
Add your .git folder to a named build context
docker build [...] --build-context dotgit=<path to your local .git folder>
Build your app with your .git folder mounted at the right place
RUN --mount=from=dotgit,target=<path to where you expect .git to be in your build container> (mvn|gradle) build
jeff-morgan-dd
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do? What is the motivation?
Adds instructions for Java service repo mapping for customers using Springboot with Maven or Gradle plugins.
Follow-up of this proposal.
Merge instructions
Merge readiness: