<p>I have built a jenkins pipeline for executing a test on a windows server. Once the automated test report is generated on the windows server, it ships that report to a different server.</p>
<p>There are methods for that automation framework (that code I can't publish and not done by me). I have done only the Jenkins pipeline part.</p>
<p>When I do a change to that framework (adding a comment or any other change) and commit it to git my pipeline works perfectly fine and report get copied to the destination server.</p>
<p>But when I execute the jenkins build in the second time without any commits it gives the following error:</p>
<pre><code>4: Failure
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
    at com.jcraft.jsch.ChannelSftp.mkdir(ChannelSftp.java:2182)
    at com.framework.Jcraft.createDirectory(Jcraft.java:116)
    at com.framework.Jcraft.transferReportToServer(Jcraft.java:48)
    at com.framework.Base.transferReportToServer(Base.java:193)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:344)
    at org.testng.SuiteRunner.run(SuiteRunner.java:276)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
    at org.testng.TestNG.runSuites(TestNG.java:1063)
    at org.testng.TestNG.run(TestNG.java:1031)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
</code></pre>
<p>Regardless the error what I am getting my question is why it works when there are new commits in the code and why it doesn't work when there are no commits (even if I add a comment it works perfectly fine)</p>
<ul>
<li>There is no space issue on the server ( already checked )</li>
<li>Monitored SFTP logs while the build execution ( I can see the session is creating successfully and closing within about 5 seconds)</li>
<li>No permission issues ( if there are permission issues this cannot be successful when there is a commit)</li>
</ul>
<p>can anyone help me to figure out this issue?</p>

CC BY-SA 4.0
2023-05-12T09:52:36.470Z
Can you comment a bit on which Jenkins plugins are being used in this pipeline?
Bruce Becker
CC BY-SA 4.0
2023-05-13T07:08:57.313Z
It _feels_ like something is getting a list of commits since the last build, and doesn't handle "none" being the answer.
Fenton
<jenkins><git><jenkins-plugins><windows><ssh>
Jenkins build fails when no commits in the code (ChannelSftp.throwStatusError)
Kasun Wimaladarma
# Jenkins build fails when no commits in the code (ChannelSftp.throwStatusError)

(Asked by: username_0 on 2023-03-27)

I have built a jenkins pipeline for executing a test on a windows server. Once the automated test report is generated on the windows server, it ships that report to a different server.
There are methods for that automation framework (that code I can't publish and not done by me). I have done only the Jenkins pipeline part.
When I do a change to that framework (adding a comment or any other change) and commit it to git my pipeline works perfectly fine and report get copied to the destination server.
But when I execute the jenkins build in the second time without any commits it gives the following error:
4: Failure
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
    at com.jcraft.jsch.ChannelSftp.mkdir(ChannelSftp.java:2182)
    at com.framework.Jcraft.createDirectory(Jcraft.java:116)
    at com.framework.Jcraft.transferReportToServer(Jcraft.java:48)
    at com.framework.Base.transferReportToServer(Base.java:193)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:62)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:385)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:321)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:344)
    at org.testng.SuiteRunner.run(SuiteRunner.java:276)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
    at org.testng.TestNG.runSuites(TestNG.java:1063)
    at org.testng.TestNG.run(TestNG.java:1031)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283)
    at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)

Regardless the error what I am getting my question is why it works when there are new commits in the code and why it doesn't work when there are no commits (even if I add a comment it works perfectly fine)

There is no space issue on the server ( already checked )
Monitored SFTP logs while the build execution ( I can see the session is creating successfully and closing within about 5 seconds)
No permission issues ( if there are permission issues this cannot be successful when there is a commit)

can anyone help me to figure out this issue?

**Tags:** jenkins, git, jenkins-plugins, windows, ssh

> **Comments:**
> **username_1**: Can you comment a bit on which Jenkins plugins are being used in this pipeline?  
> **username_2**: It _feels_ like something is getting a list of commits since the last build, and doesn't handle "none" being the answer.  

---

## 0 answers

