Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Gradle build fails when trying to retrieve git properties

Using a private repo with "Fetch whole repository" enable.

It's a java/gradle project that uses this pluging to retrieve repo/branch information

gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.2

It throws the following exception

16-Jun-2020 16:12:30 Execution failed for task ':generateGitProperties'.
16-Jun-2020 16:12:30 > org.eclipse.jgit.errors.MissingObjectException: Missing unknown ....2b49aa19472cec0750ba8

It works ok locally on my computer.

 

1 answer

The same problem. On Bamboo CI, "com.gorylenko.gradle-git-properties"  plugin can retrieve git branch name, but it fails on "git.commit.id", "git.commit.time", etc.. (from Bitbucket repository). Running on a local computer (Mac) all repo info retrieved OK.

The only thing I noticed - that plugin can not retrieve "git.commit.id" (not failed, just no value in results) before I open PR from branch on Bitbucket, but after creating PR all info are available.

As a temporary workaround I use Bamboo environment variables in conjunction with SpringBoot's buildInfo() plugin for Gradle:

springBoot {
buildInfo {
properties {
additional = [
'buildNumber': java.util.Optional.ofNullable(System.getenv("bamboo_buildNumber")).orElse("[not available]"),
'gitCommitId': java.util.Optional.ofNullable(System.getenv("bamboo_planRepository_revision")).orElse("[not available]"),
'gitBranch': java.util.Optional.ofNullable(System.getenv("bamboo_planRepository_branchName")).orElse("[not available]")
]
}
}
}


 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center 8.1 is now available

G’day Bamboo customers, Bamboo DC 8.1 is now available with it the following features and programs: SAML 2.0, OpenID Connect, and Crowd SSO In order to help admins with a simplified user manage...

180 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you