[英]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. 我们在Jenkins中运行一个执行npm install和webpack生成构建的脚本,然后创建一个tar并尝试将其复制到远程服务器。
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? 知道为什么会这样吗?
I've been encountering the same problem two weeks ago. 两周前我遇到了同样的问题。 While hitting tar from the command line, everything seemed working fine.
从命令行击中tar时,一切似乎都运行正常。
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): 尝试运行较少详细(不使用-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. 注意:考虑避免
sudo
,因为在shell脚本中使用它被认为是不好的做法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.