3

What is the best way to add existing binary files to a Jenkins pipeline build?

I have a Python script that wraps around an existing closed source binary exe file. Because it's not possible to include the exe in the GitHub repo due to licensing, I'd like to add the binary from a local server as a step in the build process. The closed source binary can be packaged for internal use but it can't be added to the SCM.

Is this possible with Jenkins's pipeline?

loneraver
  • 1,282
  • 2
  • 15
  • 22

2 Answers2

3

First, please do not store binaries in SCM, search for the proper place/tool to do it, for example Nexus Sonatype or JFrog.

Then, if you don't have time for it, at least as last option store as an Archive File in a different Job and then retrieve with CopyArtifact Plugin.

https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin

In the other hand If you want store "artifacts" or custom files in Jenkins you can check:

https://wiki.jenkins-ci.org/display/JENKINS/User+Content

Then you can download it using for example: wget

Daniel Hernández
  • 4,078
  • 6
  • 27
  • 38
0

There are three options in my opinion:

  1. Using stash/unstash feature in Pipeline plugin

here is a good tutorial on stash/unstash: Tutorial

  1. Using CopyArtifact plugin: files can be shared, copied from other jobs but remember it occupies workspace.

  2. Using shared workspace plugin. But this will only make it complicated.

Info:

Artifact: Archives are designed for longer term file storage (e.g., intermediate binaries from your builds). Artifact requires more storage space and resource management.

Stash: Saves a set of files and use later in the same build, generally on another node/workspace. stash and unstash steps are designed for use with small files. Stash/unstash can be used inside a pipeline with just assigning a name to the stash & works only locally.

lakshmi kumar
  • 558
  • 6
  • 7
  • 1) I've been using stash a lot but aren't stashes only valid for the duration of the build? They don't persist across builds, correct? 2) Does CopyArtifact work with pipeline? – loneraver May 09 '17 at 15:16
  • 1. Yes you're right. Stash is only valid for the duration of the build and it helps in saving data. 2. Yes copyartifact also works with pipeline and there is good tutorial on this. https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#code-archive-code-archive-artifacts – lakshmi kumar May 10 '17 at 09:26
  • thanks! However, I can't find the tutorial on copyartifact from your link, just the stubs of command documentation. However, I noticed that there is a "unarchive" command but in my Snippet Generator, it's listed in the Advanced/Deprecated section. Is it deprecated? – loneraver May 10 '17 at 16:38