VSTS-Agent无法chmod

时间:2018-06-21 07:30:44

标签: azure-devops

(目标计算机:RedHat 7)

我使用“复制文件”任务,该任务在使用“覆盖”选项时效果很好

但是当不使用该选项时,当vstsagent尝试chmod已经存在的文件时,我收到EPERM权限被拒绝

有一个明显的安全策略,它禁止除root(和sudo命令)外的任何其他文件系统上的chmod

我们如何在不损害系统安全性的情况下解决此问题?

谢谢

2018-06-19T13:03:59.9255736Z ##[section]Starting: Copy Files to: /data/apache/var/www/html/******
2018-06-19T13:03:59.9380638Z ==============================================================================
2018-06-19T13:03:59.9408913Z Task         : Copy Files
2018-06-19T13:03:59.9437816Z Description  : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths)
2018-06-19T13:03:59.9466225Z Version      : 2.117.0
2018-06-19T13:03:59.9494054Z Author       : Microsoft Corporation
2018-06-19T13:03:59.9522338Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=708389)
2018-06-19T13:03:59.9550616Z ==============================================================================
2018-06-19T13:04:00.5528521Z found 7 files
2018-06-19T13:04:00.5585656Z Copying /home/saehqvsts/vstsagent2/_work/r3/a/artifact/drop/delete_files.sh to /data/apache/var/www/html/******/delete_files.sh
2018-06-19T13:04:00.5743041Z Copying /home/saehqvsts/vstsagent2/_work/r3/a/artifact/drop/images/home/blog-image01.png to /data/apache/var/www/html/******/images/home/blog-image01.png
2018-06-19T13:04:00.5773633Z Copying /home/saehqvsts/vstsagent2/_work/r3/a/artifact/drop/images/home/blog-image02.png to /data/apache/var/www/html/******/images/home/blog-image02.png
2018-06-19T13:04:00.5803794Z Copying /home/saehqvsts/vstsagent2/_work/r3/a/artifact/drop/images/home/blog-image03.png to /data/apache/var/www/html/******/images/home/blog-image03.png
2018-06-19T13:04:00.5833235Z Copying /home/saehqvsts/vstsagent2/_work/r3/a/artifact/drop/index.php to /data/apache/var/www/html/******/index.php
2018-06-19T13:04:00.5861627Z shell.js: internal error
2018-06-19T13:04:00.5890403Z Error: EPERM: operation not permitted, chmod '/data/apache/var/www/html/******/index.php'
2018-06-19T13:04:00.5918532Z     at Error (native)
2018-06-19T13:04:00.5946236Z     at Object.fs.chmodSync (fs.js:1168:18)
2018-06-19T13:04:00.5975560Z     at copyFileSync (/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/node_modules/shelljs/src/cp.js:41:6)
2018-06-19T13:04:00.6005484Z     at /home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/node_modules/shelljs/src/cp.js:198:5
2018-06-19T13:04:00.6034026Z     at Array.forEach (native)
2018-06-19T13:04:00.6063516Z     at Object._cp (/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/node_modules/shelljs/src/cp.js:157:11)
2018-06-19T13:04:00.6094451Z     at Object.cp (/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/node_modules/shelljs/src/common.js:186:23)
2018-06-19T13:04:00.6124783Z     at Object.cp (/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/node_modules/vsts-task-lib/task.js:827:15)
2018-06-19T13:04:00.6154870Z     at matchedFiles.forEach.err (/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/copyfiles.js:119:20)
2018-06-19T13:04:00.6183521Z     at Array.forEach (native)
2018-06-19T13:04:00.6774571Z ##[error]Exit code 1 returned from process: file name '/home/saehqvsts/vstsagent2/externals/node/bin/node', arguments '"/home/saehqvsts/vstsagent2/_work/_tasks/CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c/2.117.0/copyfiles.js"'.
2018-06-19T13:04:00.6890413Z ##[section]Finishing: Copy Files to: /data/apache/var/www/html/******

1 个答案:

答案 0 :(得分:0)

这是因为文件存在于此处,您只需要清理该路径中的现有文件或使用“ select order_no, concat_ws('_',collect_set(distinct (channel))) as channels from table A ”选项覆盖它们即可。