POSTing zip file using httpRequest in Jenkinsfile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

POSTing zip file using httpRequest in Jenkinsfile

Christopher Burke
Hey everyone

   Part of my build pipeline requires that I publish a zip file to a server, so I'm trying the following:

response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', body:"...", url: "${urlForPublish}"

   I'm not sure how to specify the body correctly, though. Could anyone point me to an example or offer any suggestions? In the meantime, I've worked around this by using curl, but it seems like using the httpRequest step would be preferable.

   Thanks,

   --- Chris


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: POSTing zip file using httpRequest in Jenkinsfile

ingunawa

Stackoverflow is your friend : http://stackoverflow.com/questions/37945370/how-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline

You have http-request-plugin installed on your Jenkins?

 

 

 

From: <[hidden email]> on behalf of Christopher Burke <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Monday, January 30, 2017 at 1:04 PM
To: Jenkins Users <[hidden email]>
Subject: POSTing zip file using httpRequest in Jenkinsfile

 

Hey everyone

 

   Part of my build pipeline requires that I publish a zip file to a server, so I'm trying the following:

 

response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', body:"...", url: "${urlForPublish}"

 

   I'm not sure how to specify the body correctly, though. Could anyone point me to an example or offer any suggestions? In the meantime, I've worked around this by using curl, but it seems like using the httpRequest step would be preferable.

 

   Thanks,

 

   --- Chris

 

 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/B26B4D52-9B75-4789-B3C8-A5C34928EA60%40cisco.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: POSTing zip file using httpRequest in Jenkinsfile

Christopher Burke
Are you referring to the bug that was identified in a comment on that stackoverflow question? If so, it has been resolved so I assume I'm now able to use the requestBody. I'm not sure what other information in that question is pertinent as I am attmepting to read a zip file and that question relates to JSON.

That being said, I do have the http-request-plugin installed and realize I had a typo in the step I included in my first email.

    response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', requestBody:???, url: "${urlForPublish}"

I am not sure how to read the contents of my zip file and supply them as the value for requestBody.

On Monday, January 30, 2017 at 4:33:30 PM UTC-5, Indra Gunawan (ingunawa) wrote:

Stackoverflow is your friend : <a href="http://stackoverflow.com/questions/37945370/how-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F37945370%2Fhow-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrgX1yickUNfNezL92CdO3pAi5pQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F37945370%2Fhow-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrgX1yickUNfNezL92CdO3pAi5pQ&#39;;return true;"> http://stackoverflow.com/questions/37945370/how-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline

You have http-request-plugin installed on your Jenkins?

 

 

 

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com> on behalf of Christopher Burke <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">christoph...@...>
Reply-To: "<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com" <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com>
Date: Monday, January 30, 2017 at 1:04 PM
To: Jenkins Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com>
Subject: POSTing zip file using httpRequest in Jenkinsfile

 

Hey everyone

 

   Part of my build pipeline requires that I publish a zip file to a server, so I'm trying the following:

 

response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', body:"...", url: "${urlForPublish}"

 

   I'm not sure how to specify the body correctly, though. Could anyone point me to an example or offer any suggestions? In the meantime, I've worked around this by using curl, but it seems like using the httpRequest step would be preferable.

 

   Thanks,

 

   --- Chris

 

 

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="nhEVQ3k3DQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8633a708-e91d-479c-83e0-9bfb8a380393%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: POSTing zip file using httpRequest in Jenkinsfile

Guillaume Chorn
Christopher,

Did you ever find an answer to your question? I am trying to do the exact same thing and getting nowhere. Let me know.

Thanks,
Guillaume

On Tuesday, January 31, 2017 at 6:55:26 AM UTC-8, Christopher Burke wrote:
Are you referring to the bug that was identified in a comment on that stackoverflow question? If so, it has been resolved so I assume I'm now able to use the requestBody. I'm not sure what other information in that question is pertinent as I am attmepting to read a zip file and that question relates to JSON.

That being said, I do have the http-request-plugin installed and realize I had a typo in the step I included in my first email.

    response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', requestBody:???, url: "${urlForPublish}"

I am not sure how to read the contents of my zip file and supply them as the value for requestBody.

On Monday, January 30, 2017 at 4:33:30 PM UTC-5, Indra Gunawan (ingunawa) wrote:

Stackoverflow is your friend : <a href="http://stackoverflow.com/questions/37945370/how-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F37945370%2Fhow-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrgX1yickUNfNezL92CdO3pAi5pQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fstackoverflow.com%2Fquestions%2F37945370%2Fhow-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHrgX1yickUNfNezL92CdO3pAi5pQ&#39;;return true;"> http://stackoverflow.com/questions/37945370/how-to-post-json-data-in-body-with-jenkins-http-request-plugin-and-pipeline

You have http-request-plugin installed on your Jenkins?

 

 

 

From: <[hidden email]> on behalf of Christopher Burke <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Monday, January 30, 2017 at 1:04 PM
To: Jenkins Users <[hidden email]>
Subject: POSTing zip file using httpRequest in Jenkinsfile

 

Hey everyone

 

   Part of my build pipeline requires that I publish a zip file to a server, so I'm trying the following:

 

response = httpRequest httpMode: 'POST', contentType: 'APPLICATION_OCTETSTREAM', body:"...", url: "${urlForPublish}"

 

   I'm not sure how to specify the body correctly, though. Could anyone point me to an example or offer any suggestions? In the meantime, I've worked around this by using curl, but it seems like using the httpRequest step would be preferable.

 

   Thanks,

 

   --- Chris

 

 

--
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.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/43b61030-2d2c-42a9-9170-de718a796f6e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9b4df698-fc8f-4f5b-9e69-009e450ce17b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.