I am a newbie in ant. I am trying to do a simple deployment of index.html using GoCD. Basically I am trying to copy file from one folder to /var/www/html (which basically requires sudo permission to do). Here's my ant script:
<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>
I am trying to build this build.xml, deployment is successful, but file is not copied as scripted.
I have tried replacing copy target with the following:
<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>
Here the error is thrown like "BUILD FAILED/var/lib/go-agent/pipelines/Test-Pipeline/build.xml:5: copy doesn't support the "if" attribute"
Can someone please help me as I am stuck with no proper directions to go. What I want to achieve is copy file to a folder with sudo permission.