Search code examples
bashshelljenkinstarbzip2

How to use tar + pbzip2 with Jenkins


I've been trying to find ways to cut my Jenkins build time as much as possible, and thanks to this helpful SO post, I found pbzip2: Utilizing multi core for tar+gzip/bzip compression/decompression

Works great! A 6 min compression time was brought down to 2 mins on my machine with the following:

tar -v -c --use-compress-program=pbzip2 -f parallel.tar.bzip2 myapplication.app

But Jenkins just barfs with a Execute Shell task where I put in the above command:

+ tar -v -c --use-compress-program=pbzip2 -f parallel.tar.bz2 myapplication.app a myapplication.appBuild step 'Execute shell' marked build as failure

The fact that the "Build step" line is getting mashed together with the output from the tar tells me it might be a background process issue that tar/pbzip2 is introducing.

I've tried introducing a #!/bin/bash -xe and get the same results. I've tried wrapping the tar command in an if statement. I've also tried putting tar in a background thread itself with & and waiting for it. Same result.

Is there any techniques I could implement to help the Jenkins process out?


Solution

  • Found out that even though I can run this command as the jenkins user through command line, pbzip2 wasn't defined in the PATH for the Jenkins job. Pretty misleading since there wasn't useful output.