java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml

Jenkins JIRA | woneill | 3 years ago
  1. 0

    Patch that was submitted includes a removal of the file 'modules/puppet/files/master/hiera.yaml' from the repo. Here's the output from the job: Failed to apply patch due to: java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:229) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:219) at hudson.FilePath.act(FilePath.java:914) at hudson.FilePath.act(FilePath.java:887) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:164) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:47) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:153) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1689) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 20 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:225) ... 12 more FATAL: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:229) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:219) at hudson.FilePath.act(FilePath.java:914) at hudson.FilePath.act(FilePath.java:887) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:164) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:47) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:153) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1689) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 20 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:225) ... 12 more

    Jenkins JIRA | 3 years ago | woneill
    java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml
  2. 0

    Patch that was submitted includes a removal of the file 'modules/puppet/files/master/hiera.yaml' from the repo. Here's the output from the job: Failed to apply patch due to: java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:229) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:219) at hudson.FilePath.act(FilePath.java:914) at hudson.FilePath.act(FilePath.java:887) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:164) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:47) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:153) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1689) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 20 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:225) ... 12 more FATAL: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:229) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:219) at hudson.FilePath.act(FilePath.java:914) at hudson.FilePath.act(FilePath.java:887) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:164) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:47) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:153) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523) at hudson.model.Run.execute(Run.java:1689) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:231) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 20 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:225) ... 12 more

    Jenkins JIRA | 3 years ago | woneill
    java.io.IOException: Failed to patch /var/lib/jenkins/jobs/puppet-modules-peerreview/workspace/a/modules/puppet/files/master/hiera.yaml
  3. 0

    ReviewBot can't apply the diff and failed to patch file

    GitHub | 2 years ago | alex7c4
    java.io.IOException: Failed to patch /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace/_ak.sh
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 18#77771478

    GitHub | 2 years ago | moorecm
    java.io.IOException: Failed to patch /usr0/jenkins/jobs/ting-trunk job02b -- parameterized build/workspace/test/pan/log/test_panlog.py
  6. 0

    Hello! Please help to find solution for the following issue (bug?): ReviewBot can't apply diff and patch file if modifications has been done in the middle of the file (Jenkins build failed). In case of addition modifications only to the new line in the END of the file - all is OK. (Jenkins build passed). Here are details: 1. I've added only one word "#comment" at 3rd line: 1: #!/bin/bash 2: echo "Hello" 3: echo "I am script# 1" #comment <--Only word "#comment" has been added. 4: exit Then git commit and git push. 2. See git log from GIT client: root@sochi-1:/opt/git_client# git log -p -1 dev commit f4d46f33fe2f4c5cd41cb938d5152fcff896d473 Author: akoryag Date: Mon Aug 18 18:17:23 2014 +0400 [reviewgroup #review-group][refs #11]: only comment added diff --git a/_ak.sh b/_ak.sh index 87295da..39ab760 100644 --- a/_ak.sh +++ b/_ak.sh @@ -1,4 +1,4 @@ #!/bin/bash echo "Hello" -echo "I am script# 1" +echo "I am script# 1" #comment exit \ No newline at end of file 3. Check git diff: root@sochi-1:/opt/git_client# git diff 87295da 39ab760 diff --git a/87295da b/39ab760 index 87295da..39ab760 100644 --- a/87295da +++ b/39ab760 @@ -1,4 +1,4 @@ #!/bin/bash echo "Hello" -echo "I am script# 1" +echo "I am script# 1" #comment exit \ No newline at end of file 4. Check generated diff file from ReviewBoard "rb17.patch" (the same as above): diff --git a/_ak.sh b/_ak.sh index 87295daca19ff8d315fc6079bc2e9628e88b83ca..39ab7607fb59590e2e16e26fcbd77c58a2c27a6a 100644 --- a/_ak.sh +++ b/_ak.sh @@ -1,4 +1,4 @@ #!/bin/bash echo "Hello" -echo "I am script# 1" +echo "I am script# 1" #comment exit \ No newline at end of file 5. Jenkins try to build this small script, but fails due to "Failed to apply patch": Started by command line by anonymous Building in workspace /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace Cloning the remote Git repository Cloning repository git@192.168.207.26:/opt/git/mera-ci-test.git > /usr/bin/git init /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace # timeout=10 Fetching upstream changes from git@192.168.207.26:/opt/git/mera-ci-test.git > /usr/bin/git --version # timeout=10 > /usr/bin/git fetch --tags --progress git@192.168.207.26:/opt/git/mera-ci-test.git +refs/heads/*:refs/remotes/origin/* > /usr/bin/git config remote.origin.url git@192.168.207.26:/opt/git/mera-ci-test.git # timeout=10 > /usr/bin/git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 > /usr/bin/git config remote.origin.url git@192.168.207.26:/opt/git/mera-ci-test.git # timeout=10 Fetching upstream changes from git@192.168.207.26:/opt/git/mera-ci-test.git > /usr/bin/git fetch --tags --progress git@192.168.207.26:/opt/git/mera-ci-test.git +refs/heads/*:refs/remotes/origin/* > /usr/bin/git rev-parse refs/remotes/origin/dev^{commit} # timeout=10 > /usr/bin/git rev-parse refs/remotes/origin/origin/dev^{commit} # timeout=10 Checking out Revision f4d46f33fe2f4c5cd41cb938d5152fcff896d473 (refs/remotes/origin/dev) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f f4d46f33fe2f4c5cd41cb938d5152fcff896d473 > /usr/bin/git rev-list 8751e4151bd8839df9ac93b75b7995aa10ed546d # timeout=10 Applying the diff Failed to apply patch due to: java.io.IOException: Failed to patch /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace/_ak.sh at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:250) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:240) at hudson.FilePath.act(FilePath.java:922) at hudson.FilePath.act(FilePath.java:895) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:183) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:51) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:227) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535) at hudson.model.Run.execute(Run.java:1740) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:234) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 4 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:246) ... 12 more FATAL: Failed to patch /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace/_ak.sh java.io.IOException: Failed to patch /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace/_ak.sh at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:250) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:240) at hudson.FilePath.act(FilePath.java:922) at hudson.FilePath.act(FilePath.java:895) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:183) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:51) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:227) at hudson.model.Build$BuildExecution.doRun(Build.java:154) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535) at hudson.model.Run.execute(Run.java:1740) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:234) Caused by: com.cloudbees.diff.PatchException: Cannot apply hunk @@ 4 at com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228) at com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155) at com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108) at org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:246) ... 12 more Interesting thing that if I'll add something ONLY in the END of the script, job will be build successfully. 6. I've added only last string "#last line - OK" at 5th line: 1: #!/bin/bash 2: echo "Hello" 3: echo "I am script# 1" #comment 4: exit 5: #last line - OK <--Only last string "#last line - OK" has been added. Then git commit and git push. 7. Check git log after last line has been added: root@sochi-1:/opt/git_client# git log -p -1 dev commit 6bf3ca934255fa75b71efd7eb970919fb068ece0 Author: akoryag Date: Mon Aug 18 18:34:30 2014 +0400 [reviewgroup #review-group][refs #11]: last line diff --git a/_ak.sh b/_ak.sh index 39ab760..641a134 100644 --- a/_ak.sh +++ b/_ak.sh @@ -1,4 +1,5 @@ #!/bin/bash echo "Hello" echo "I am script# 1" #comment -exit \ No newline at end of file +exit +#last line - OK \ No newline at end of file 8. Check git diff: root@sochi-1:/opt/git_client# git diff 39ab760 641a134 diff --git a/39ab760 b/641a134 index 39ab760..641a134 100644 --- a/39ab760 +++ b/641a134 @@ -1,4 +1,5 @@ #!/bin/bash echo "Hello" echo "I am script# 1" #comment -exit \ No newline at end of file +exit +#last line - OK \ No newline at end of file 9. Check generated diff file from ReviewBoard "rb18.patch" (the same as above): diff --git a/_ak.sh b/_ak.sh index 39ab7607fb59590e2e16e26fcbd77c58a2c27a6a..641a134e7f84f225706511a3ce26a52c90e1f6eb 100644 --- a/_ak.sh +++ b/_ak.sh @@ -1,4 +1,5 @@ #!/bin/bash echo "Hello" echo "I am script# 1" #comment -exit \ No newline at end of file +exit +#last line - OK \ No newline at end of file 10. Jenkins successfully build script with only LAST line added: Started by command line by anonymous Building in workspace /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > /usr/bin/git config remote.origin.url git@192.168.207.26:/opt/git/mera-ci-test.git # timeout=10 Fetching upstream changes from git@192.168.207.26:/opt/git/mera-ci-test.git > /usr/bin/git --version # timeout=10 > /usr/bin/git fetch --tags --progress git@192.168.207.26:/opt/git/mera-ci-test.git +refs/heads/*:refs/remotes/origin/* > /usr/bin/git rev-parse refs/remotes/origin/dev^{commit} # timeout=10 > /usr/bin/git rev-parse refs/remotes/origin/origin/dev^{commit} # timeout=10 Checking out Revision 6bf3ca934255fa75b71efd7eb970919fb068ece0 (refs/remotes/origin/dev) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f 6bf3ca934255fa75b71efd7eb970919fb068ece0 > /usr/bin/git rev-list f4d46f33fe2f4c5cd41cb938d5152fcff896d473 # timeout=10 Applying the diff Going to notify reviewboard about #16 Finished: SUCCESS Tell me please what is wrong with diff generation? Thanks a lot. Configuration: Jenkins ver. 1.575 jenkins-reviewbot 2.0 Review Board 2.0.5 git version 1.9.1 Ubuntu 14.04.1 LTS

    Jenkins JIRA | 2 years ago | Alex Kor
    java.io.IOException: Failed to patch /opt/jenkins-1.575-0/apps/jenkins/jenkins_home/jobs/freestylesoftwareproject/workspace/_ak.sh

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.cloudbees.diff.PatchException

      Cannot apply hunk @@ 20

      at com.cloudbees.diff.ContextualPatch.applyHunk()
    2. Pure Java implementation of diff/patch
      ContextualPatch.patch
      1. com.cloudbees.diff.ContextualPatch.applyHunk(ContextualPatch.java:228)
      2. com.cloudbees.diff.ContextualPatch.applyPatch(ContextualPatch.java:155)
      3. com.cloudbees.diff.ContextualPatch.patch(ContextualPatch.java:108)
      3 frames
    3. org.jenkinsci.plugins
      ReviewboardParameterValue$ApplyTask.invoke
      1. org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:225)
      2. org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ApplyTask.invoke(ReviewboardParameterValue.java:219)
      2 frames
    4. Hudson
      FilePath.act
      1. hudson.FilePath.act(FilePath.java:914)
      2. hudson.FilePath.act(FilePath.java:887)
      2 frames
    5. org.jenkinsci.plugins
      ReviewboardParameterValue$ReviewboardBuildWrapper.setUp
      1. org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.applyPatch(ReviewboardParameterValue.java:164)
      2. org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue.access$200(ReviewboardParameterValue.java:47)
      3. org.jenkinsci.plugins.jenkinsreviewbot.ReviewboardParameterValue$ReviewboardBuildWrapper.setUp(ReviewboardParameterValue.java:206)
      3 frames
    6. Hudson
      Executor.run
      1. hudson.model.Build$BuildExecution.doRun(Build.java:153)
      2. hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:523)
      3. hudson.model.Run.execute(Run.java:1689)
      4. hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      5. hudson.model.ResourceController.execute(ResourceController.java:88)
      6. hudson.model.Executor.run(Executor.java:231)
      6 frames