首页 > 解决方案 > rsync 命令因詹金而失败

问题描述

在尝试从 macOS Catalina 终端执行 rsync 命令时,我能够成功地将数据从卷复制到本地驱动器

这是正在使用的命令

rsync -avxhPE /Volumes/pathtofolder/assets/. ./assets

但是同样的命令在 Jenkins 中不起作用。我收到以下错误。

 + rsync -avxhPE /Volumes/pathtofolder/assets/. ./assets
19:28:22 building file list ... 
19:28:24  0 files...
rsync: opendir "/Volumes/pathtofolder/assets/." failed: Operation not permitted (1)
19:28:24 1 file to consider
19:28:24 ./
19:28:24 
19:28:24 sent 83 bytes  received 26 bytes  43.60 bytes/sec
19:28:24 total size is 0  speedup is 0.00
19:28:24 rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/main.c(996) [sender=2.6.9]
19:28:24 Build step 'Execute shell' marked build as failure
19:28:24 Finished: FAILURE

标签: shellunixjenkinsrsync

解决方案


运行的用户jenkins没有读取目录的权限。检查这一行:

rsync: opendir "/Volumes/pathtofolder/assets/." failed: Operation not permitted (1)

推荐阅读