Skip to content

[SCICM-6923] read git information from git properties for java apps#35103

Merged
olivwalsh merged 5 commits intomasterfrom
olivia.walsh/java-doc/git-properties
Mar 10, 2026
Merged

[SCICM-6923] read git information from git properties for java apps#35103
olivwalsh merged 5 commits intomasterfrom
olivia.walsh/java-doc/git-properties

Conversation

@olivwalsh
Copy link
Contributor

@olivwalsh olivwalsh commented Mar 9, 2026

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:

  • Ready for merge

@github-actions github-actions bot added the Architecture Everything related to the Doc backend label Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Preview links (active after the build_preview check completes)

Modified Files

plugins {
id("org.springframework.boot") version "X.X.X" // required
// ...
id("com.gorylenko.gradle-git-properties") version "2.5.2"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

@wmouchere wmouchere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@olivwalsh olivwalsh marked this pull request as ready for review March 10, 2026 11:03
@olivwalsh olivwalsh requested a review from a team as a code owner March 10, 2026 11:03
@jeff-morgan-dd jeff-morgan-dd self-assigned this Mar 10, 2026
@olivwalsh olivwalsh merged commit 33d4bd0 into master Mar 10, 2026
26 of 27 checks passed
@olivwalsh olivwalsh deleted the olivia.walsh/java-doc/git-properties branch March 10, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Architecture Everything related to the Doc backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants