我是一个新手在蚂蚁。我正在尝试使用GoCD来简单部署index.html。基本上我试图将文件从一个文件夹复制到/ var/www/html(基本上需要sudo权限)。这里是我的ant脚本:蚂蚁,sudo和copynot工作
<project name="My Project" default="help" basedir=".">
<condition property="rootTasksEnabled">
<equals arg1="ec2-user" arg2="root" />
</condition>
<target name="copy" description="Copy New Web Page" if="rootTasksEnabled">
<copy file="/var/lib/go-agent/pipelines/Test-Pipeline/index.html" todir="/var/www/html"/>
</target>
</project>
我想建立这样的build.xml,部署成功,但作为脚本文件是不可复制的。
我试图与替代复制目标如下:
<project name="My Project" default="help" basedir=".">
<condition property="rootTasksEnabled">
<equals arg1="ec2-user" arg2="root" />
</condition>
<copy todir="/var/www/html" flatten="true" if="rootTasksEnabled">
<resources>
<file file="/var/lib/go-agent/pipelines/Test-Pipeline/index.html"/>
</resources>
</copy>
</project>
这里引发错误,如“建立失效 /var/lib/go-agent/pipelines/Test-Pipeline/build.xml: 5:复制不支持“if”属性“
有人可以帮助我,因为我被困在没有适当的方向去。我想实现的是将文件复制到具有sudo权限的文件夹。
请仔细阅读[?在什么情况下我想补充“紧急”或其他类似的短语我的问题,为了获得更快的答案](// meta.stackoverflow.com/q/326569) - 总结是,这不是解决志愿者问题的理想方式,而且可能对获得答案起反作用。请不要将这添加到您的问题。 – halfer