You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Greg Harris (Jira)" <ji...@apache.org> on 2023/02/27 22:27:00 UTC

[jira] [Commented] (KAFKA-14767) Gradle build fails with missing commitId after git gc

    [ https://issues.apache.org/jira/browse/KAFKA-14767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17694207#comment-17694207 ] 

Greg Harris commented on KAFKA-14767:
-------------------------------------

This happens occasionally when git performs an automatic `gc`, and often causes build failures when I merge `trunk` into my development branches. My build usually won't complete until I finish the merge commit, which I may have to go back and amend if i introduced any build breakages.

I know of one workaround: Take the branch you're working on and move it to re-create the non-gc'd refs file:
{noformat}
brach=<affected branch>
git checkout -b placeholder
git branch -f $branch trunk
git branch -f $branch placeholder
git checkout $branch
git branch -D placeholder{noformat}

> Gradle build fails with missing commitId after git gc
> -----------------------------------------------------
>
>                 Key: KAFKA-14767
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14767
>             Project: Kafka
>          Issue Type: Bug
>          Components: build
>            Reporter: Greg Harris
>            Priority: Minor
>
> Reproduction steps:
> 1. `git gc`
> 2. `./gradlew jar`
> Expected behavior: build completes successfully (or shows other build errors)
> Actual behavior:
> {noformat}
> Task failed with an exception.
> -----------
> * What went wrong:
> A problem was found with the configuration of task ':storage:createVersionFile' (type 'DefaultTask').
>   - Property 'commitId' doesn't have a configured value.
>     
>     Reason: This property isn't marked as optional and no value has been configured.
>     
>     Possible solutions:
>       1. Assign a value to 'commitId'.
>       2. Mark property 'commitId' as optional.
>     
>     Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#value_not_set for more details about this problem.{noformat}
> This appears to be due to the fact that the build.gradle determineCommitId() function is unable to read the git commit hash for the current HEAD. This appears to happen after a `git gc` takes place, which causes the `.git/refs/heads/*` files to be moved to `.git/packed-refs`.
> The determineCommitId() should be patched to also try reading from the packed-refs to determine the commit hash.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)