Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins script tar: write error

We run a script in Jenkins that perform npm install and webpack production build, After that it creates a tar and try to copy it to a remote server.

script example:

  npm install
  npm run build
  cd build
  sudo tar -zcvf ../${TGZ_FILE} .

But we get that error:

tar: write error

Any idea why it happens?

like image 603
Shai M. Avatar asked May 31 '16 08:05

Shai M.


1 Answers

I've been encountering the same problem two weeks ago. While hitting tar from the command line, everything seemed working fine.

I had a strange feeling, that Jenkins couldn't handle that much output (which of course makes no sense) and removed the verbose flag. That somehow solved our issues.

Try running less verbose (without -v):

npm install
npm run build
cd build
sudo tar -zcf ../${TGZ_FILE} .

To be honest, I have no idea yet, what caused these issues - however, I hope it solves your problem, too.

Notice: Think about avoiding sudo, since it's considered bad practice to use it in shell scripts.

like image 130
Jazzschmidt Avatar answered Oct 18 '22 17:10

Jazzschmidt