Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory after upgrading to Gradle 5.1 #65

Closed
chali opened this issue Jan 29, 2019 · 8 comments
Closed

No such file or directory after upgrading to Gradle 5.1 #65

chali opened this issue Jan 29, 2019 · 8 comments
Labels

Comments

@chali
Copy link

chali commented Jan 29, 2019

Summary

When I'm running gitPublishPush in a freshly cloned project without local gradle project cache (.gradle directory) and any build output directory the build fails during gitPublishCommit with this error: Exception caught during execution of add command.

When I'm running the same command again the build is successful. When I'm using Gradle 5.0 even the first build is successful.

Build file

buildscript {
    repositories {
        gradlePluginPortal()
    }

    dependencies {
        classpath "org.ajoberstar.grgit:grgit-gradle:3.0.0"
        classpath "org.ajoberstar:gradle-git-publish:2.0.0"
    }
}

apply plugin: 'java'
apply plugin: "org.ajoberstar.grgit"
apply plugin: "org.ajoberstar.git-publish"

gitPublish {

    branch = "gh-pages"

    contents {
        into("docs/") {
            from new File(project.projectDir, 'docs.txt')
        }
    }

    commitMessage = "Documentation generated"
}

gitPublishPush {
    onlyIf {
        System.env."CI"
    }
}

Here is a complete sample project: https://github.com/chali/genie

Command to reproduce

rm -Rf .gradle build && ./gradlew clean build gitPublishPush --stacktrace --info

Output

> Task :gitPublishReset
Task ':gitPublishReset' is not up-to-date because:
  Task.upToDateWhen is false.
:gitPublishReset (Thread[Execution worker for ':',5,main]) completed. Took 39.352 secs.
:gitPublishCopy (Thread[Execution worker for ':',5,main]) started.

> Task :gitPublishCopy
Deleting stale output file: /Users/mchalupa/projects/others/genie/build/gitPublish
Task ':gitPublishCopy' is not up-to-date because:
  No history is available.
:gitPublishCopy (Thread[Execution worker for ':',5,main]) completed. Took 0.01 secs.
:gitPublishCommit (Thread[Execution worker for ':',5,main]) started.

> Task :gitPublishCommit FAILED
Task ':gitPublishCommit' is not up-to-date because:
  Task.upToDateWhen is false.
:gitPublishCommit (Thread[Execution worker for ':',5,main]) completed. Took 0.016 secs.
Closing Git repo: /Users/mchalupa/projects/others/genie/.git
Closing Git publish repo: /Users/mchalupa/projects/others/genie/build/gitPublish

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gitPublishCommit'.
> Exception caught during execution of add command

* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':gitPublishCommit'.
        ... stacktrace omitted ...
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of add command
        at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:257)
        at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:1)
        at java_util_concurrent_Callable$call$6.call(Unknown Source)
        at org.ajoberstar.grgit.operation.AddOp.call(AddOp.groovy:38)
        at org.ajoberstar.grgit.operation.AddOp.call(AddOp.groovy)
        at java_util_concurrent_Callable$call$5.call(Unknown Source)
        at org.ajoberstar.grgit.internal.OpSyntax.samOperation(OpSyntax.groovy:26)
        at org.ajoberstar.grgit.internal.OpSyntax$samOperation$1.callStatic(Unknown Source)
        at org.ajoberstar.grgit.internal.OpSyntax$samOperation$1.callStatic(Unknown Source)
        at org.ajoberstar.grgit.Grgit.add(Grgit.groovy)
        at org.ajoberstar.gradle.git.publish.tasks.GitPublishCommit.commit(GitPublishCommit.java:46)
        ... stacktrace omitted ...
Caused by: java.io.IOException: No such file or directory
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.newTempFile(ObjectDirectoryInserter.java:279)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.toTemp(ObjectDirectoryInserter.java:245)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:113)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:142)
        at org.eclipse.jgit.internal.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:122)
        at org.eclipse.jgit.api.AddCommand.call(AddCommand.java:239)
        ... 79 more

It looks very similar as #35. It looks like handling of stale task output might be involved because:
Deleting stale output file: /Users/mchalupa/projects/others/genie/build/gitPublish is happening before commit and commit should use the content of deleted directory.

@chali
Copy link
Author

chali commented Jan 29, 2019

@ajoberstar please, let me know if the example is sufficiently small or if I can help anyhow.

tgianos added a commit to tgianos/genie that referenced this issue Jan 29, 2019
tgianos added a commit to Netflix/genie that referenced this issue Jan 29, 2019
@mnlipp
Copy link

mnlipp commented Feb 1, 2019

I can confirm the problem for my project.

mnlipp added a commit to mnlipp/jgrapes that referenced this issue Feb 1, 2019
@kdubb
Copy link

kdubb commented Feb 2, 2019

Happening for me as well. Workaround in travis seems to be to execute it twice, ignoring the result of the first execution.

mnlipp added a commit to mnlipp/jgrapes-webconsole that referenced this issue Feb 2, 2019
mnlipp added a commit to mnlipp/jgrapes-osgi that referenced this issue Feb 2, 2019
@ajoberstar ajoberstar added the bug label Feb 26, 2019
@ajoberstar
Copy link
Owner

Sorry for the delayed response on this and thanks for the detail in this issue.

Trying to reproduce this on my Windows 10 box, I'm hitting #68 and not getting any farther. Won't be able to get back to this right away, but if anyone else can, please let us know if you identify anything.

@ajoberstar
Copy link
Owner

#68 seemed to go away on Gradle 5.3+. When upgrading your sample project to 5.4.1, everything seemed to work without a build/ or .gradle/ (on a Windows 10 box).

Could you try upgrading to the latest Gradle (and gradle-git-publish) and let me know if this is still an issue?

@mnlipp
Copy link

mnlipp commented May 16, 2019

It works with gradle 5.4.1 for one of my projects. I'm going to try successivly for the others.

@tgianos
Copy link

tgianos commented May 17, 2019

@chali has been out on vacation so I doubt he's seen this yet but he opened this after investigating some issues we were having with our project. His sample project is a simplified version of our flow. I upgraded Gradle and your plugins yesterday and it looks like our build succeeded now so this is likely fixed in the later versions of gradle as you say. I'll like @chali chime in when he's back which I believe is next week.

@chali
Copy link
Author

chali commented May 21, 2019

I confirm that Gradle 5.4.1 doesn't have the problem. Thank you @ajoberstar for the investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants