Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-14767

Gradle build fails with missing commitId after git gc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.4.2, 3.5.2, 3.7.0, 3.6.1
    • build
    • None

    Description

      Reproduction steps:
      1. `git gc`
      2. `./gradlew jar`

      Expected behavior: build completes successfully (or shows other build errors)
      Actual behavior:

      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.

      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.

      Attachments

        Issue Links

          Activity

            People

              gharris1727 Greg Harris
              gharris1727 Greg Harris
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: