Re: How to read the file in slave node?

25 views
Skip to first unread message
Message has been deleted

Jesse Glick

unread,
Oct 3, 2018, 3:32:32 PM10/3/18
to Jenkins Dev
On Tue, Oct 2, 2018 at 4:40 AM JIHYE LEE <ejan...@gmail.com> wrote:
> Result Log Message
> java.lang.IllegalArgumentException: /Users/builder/workspace/test/project_test/abc.txt does not exist

At a bare minimum you would need to include the stack trace from this
exception, in order for readers of this list to even know which
component is responsible for the issue.

JIHYE LEE

unread,
Oct 4, 2018, 3:18:42 AM10/4/18
to Jenkins Developers
java.io.FileNotFoundException: /Users/builder/workspace/smartdl_test/smdl/abc.txt (No such file or directory)
	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at org.apache.http.entity.FileEntity.writeTo(FileEntity.java:94)
	at org.apache.http.impl.DefaultBHttpClientConnection.sendRequestEntity(DefaultBHttpClientConnection.java:156)
	at org.apache.http.impl.conn.CPoolProxy.sendRequestEntity(CPoolProxy.java:160)
	at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:238)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
	at com.toast.cloud.smartdl.builduploader.request.objectstorage.ObjectStorageRequestImpl.uploadObject(ObjectStorageRequestImpl.java:141)
	at com.toast.cloud.smartdl.builduploader.request.objectstorage.ObjectStorageRequestImpl.uploadObject(ObjectStorageRequestImpl.java:76)
	at com.toast.cloud.smartdl.builduploader.BuildUploaderPublisher.perform(BuildUploaderPublisher.java:196)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:80)
	at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:67)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:49)
	at hudson.security.ACL.impersonate(ACL.java:290)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:46)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

This is stack trace. 
Thank you. 

JIHYE LEE

unread,
Oct 4, 2018, 3:18:44 AM10/4/18
to Jenkins Developers


2018년 10월 2일 화요일 오후 5시 40분 45초 UTC+9, JIHYE LEE 님의 말:
Hi ! 
I'm developing jenkins plugin using pipeline. 

There is part of code.

private int uploadObject(String containerName, String path, FilePath uploadFilePath)
{
   if(false == uploadFilePath.exsit()) { // result is true!!
        ....
        exception;
   }

    InputStreamEntity inputStreamEntity = new InputStreamEntity(uploadFilePath.read(),-1);
   ....

    HttpUriRequest request =
            RequestBuilder.create(method)
           .setUri(uri)
           .setHeader(header)
           .setEntity(inputStreamEntity)
           .build();
   
.....
}


Result Log Message
java.lang.IllegalArgumentException: /Users/builder/workspace/test/project_test/abc.txt does not exist


If the plugin run on master node, it's working with out any problem. 
But when I test it on slave, can't find the file.. 
When I check if the file or directory is exist or not, it is existed.


How can i use or read the file on slave? Could you help me please?  



Jesse Glick

unread,
Oct 4, 2018, 8:32:17 AM10/4/18
to Jenkins Dev
On Thu, Oct 4, 2018 at 3:18 AM JIHYE LEE <ejan...@gmail.com> wrote:
> at java.io.FileInputStream.<init>(FileInputStream.java:138)
> at org.apache.http.entity.FileEntity.writeTo(FileEntity.java:94)
> […]
> at com.toast.cloud.smartdl.builduploader.request.objectstorage.ObjectStorageRequestImpl.uploadObject(ObjectStorageRequestImpl.java:141)

Looks like somewhere you were creating a `FileEntity`, rather than the
`InputStreamEntity` claimed in your quoted source code. If that
`FileEntity` were constructed with a workspace file path, then of
course your call would not work, since the HTTP call is running on the
master, where no such path exists.

It is best to link to actual sources on GitHub.
Reply all
Reply to author
Forward
0 new messages