The apache http client post request fails on jenkins swarm slave

89 views
Skip to first unread message

Shoujin Wang

unread,
Jan 11, 2014, 9:41:19 PM1/11/14
to jenkins...@googlegroups.com
Hi,

I wrote a jenkins plugin to upload RPM artifact to nexus. When the job is run on swarm slave, it always fails on http post request.
I also attached the source code for the whole project for reference. The failure happens on NexusResfulClient.java as the following:
Any comments are welcomed!

HttpPost httpPost = new HttpPost(this.nexusUrl+"/service/local/artifact/maven/content");

String pkgName = file.getName();

RpmPackageInfo pkgInfo = new RpmPackageInfo(pkgName);

MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();

entityBuilder.addTextBody("r", this.repoName);

entityBuilder.addTextBody("g", this.repoGroup);

entityBuilder.addTextBody("e", "rpm");

entityBuilder.addTextBody("hasPom", "false");

entityBuilder.addTextBody("a", pkgInfo.getName());

entityBuilder.addTextBody("p", "rpm");

entityBuilder.addTextBody("v", pkgInfo.getVersion()+"-"+pkgInfo.getTimeStamp()+"."+pkgInfo.getArch());

FileBody uploadFilePart = new FileBody(file );

entityBuilder.addPart("upload_file", uploadFilePart);

httpPost.setEntity(entityBuilder.build());


try {

System.out.println("Start uploading file : " + file.getName());

HttpResponse response = httpclient.execute(httpPost);  -- always fails here.

try {

                HttpEntity entity = response.getEntity();

The error message on jenkins.

IOException for fp.act(new UploadRpm())
============================================
= traceback
hudson.FilePath.act(FilePath.java:912)
hudson.FilePath.act(FilePath.java:889)
com.sfdc.jenkinsnexusartifact.NexusRpmBuilder.perform(NexusRpmBuilder.java:155)
hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:781)
hudson.model.Build$BuildExecution.build(Build.java:199)
hudson.model.Build$BuildExecution.doRun(Build.java:160)
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:562)
hudson.model.Run.execute(Run.java:1665)
hudson.matrix.MatrixRun.run(MatrixRun.java:146)
hudson.model.ResourceController.execute(ResourceController.java:88)
hudson.model.Executor.run(Executor.java:246)
hudson.util.IOException2: remote file operation failed: /home/jenkins-slave/workspace/00_packages/idlc/latest/idlc-puppet-modules-1.0.0-140111183208_devtest.noarch.rpm at hudson.remoting.Channel@5590eab2:jenkin-slave.sf.com
IOException for fp.act(new UploadRpm())

Best regards,
Shoujin Wang
src.tar

Mark Waite

unread,
Jan 14, 2014, 6:06:06 PM1/14/14
to jenkins...@googlegroups.com
I'm not sure if your swam slave related failure is the same as mine, but mine was similar to the problem described in:


There was an incompatibility between one or more components on the server and the needed components in the slave jar file.

I submitted a pull request with my proposed change.  


I'm not sure it is the correct change.  There are several other pull requests submitted which seem to be attempting to fix the same root problem.  If you're feeling adventurous, you could build from the source code of the swarm plugin and add that pull request to see if it fixes your problem.  Alternately, if you're willing to trust a jar file directly from me, I can send you an updated swarm jar file to try.

Mark Waite


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks!
Mark Waite

Shoujin Wang

unread,
Jan 14, 2014, 6:50:57 PM1/14/14
to jenkins...@googlegroups.com
Thanks Mark!
Please send me your jar and let me give it a try. Thanks so much for the help!


Regards,
Autumn Wang


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/UnQlZV6-dus/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.

Mark Waite

unread,
Jan 14, 2014, 7:37:03 PM1/14/14
to jenkins...@googlegroups.com
I've sent it to you directly so that I don't waste list bandwidth sending it to everyone.

Let me know if it helps (or not).

Thanks,
Mark Waite
Reply all
Reply to author
Forward
0 new messages