Passing parameter/variable to nant tast

Follow

Comments

8 comments

  • Avatar
    Sharanya Bathey

    Hi Devin, 

     

    Since ClientBin and Felix are upstream pipelines, you can specify their labels in the task by using the Go environment variables.

    Please refer to the following documentation link for ways to access this and use it in your Nant build task  -

    http://www.thoughtworks-studios.com/docs/go/current/help/dev_use_current_revision_in_build.html 

    The one material and multiple material sections also describe sample usages.

     

    Regards,

    Sharanya

  • Avatar
    Devin Quince

    Sorry, I am understanding how to get this to work in my pipeline. What I want to do is take what is built my pipeline and copy to a location with a name based on the pipeline label i.e. \\servername\pipelinelabel\filename

  • Avatar
    Sharanya Bathey

    If you are looking to use the pipeline label of the current pipeline, then using "\\servername\${env.GO_PIPELINE_LABEL}\filename" in your Nant script should work.

    If your looking for the upstream pipeline, only the pipeline label is available, the upstream pipeline names are not available. 

    Go sets all the environment variables discussed in the above link, you can use any of them in maner mentioned above in your scripts. 

     

    Regards,

    Sharanya

  • Avatar
    Devin Quince

    Thanks. I tried this and all I get is this in my path

    \\servername\DevArchive\3.5_Installer_archive\Troppus Software\${env.GO_PIPELINE_LABEL}

    Here is the syntax I am using in my pipeline.

    <nant nantpath="..\Lib\NAnt" buildfile="fileutils.build" target="Copy -D:from=&quot;..\PROJECT_ASSISTANT\SINGLE_EXE_IMAGE\DiskImages\DISK1\Digital Life Now Setup.exe&quot; -D:to=&quot;\\servername\DevArchive\3.5_Installer_archive\#{Provider}\${env.GO_PIPELINE_LABEL}\#{Environment}-#{Edition}.exe&quot;" workingdir="build">
    <runif status="passed" />
    </nant>

    Am I missing something? Does env need to a parameter or variable?

    Thanks again

  • Avatar
    Sharanya Bathey

    Hi Devin,

     

    In the task mentioned by you:

    <nant nantpath="..\Lib\NAnt" buildfile="fileutils.build" target="Copy -D:from=&quot;..\PROJECT_ASSISTANT\SINGLE_EXE_IMAGE\DiskImages\DISK1\Digital Life Now Setup.exe&quot; -D:to=&quot;\\servername\DevArchive\3.5_Installer_archive\#{Provider}\${env.GO_PIPELINE_LABEL}\#{Environment}-#{Edition}.exe&quot;" workingdir="build">
    <runif status="passed" />
    </nant>


    The target tag is to specify the targets you want to execute in the build file.

    Please refer to the following link http://www.thoughtworks-studios.com/docs/go/12.4/help/configuration_reference.html and look at the Nant task for further information. 


    You cannot perform the copy operation through the target, instead you can do something like the following in your build script:

    <target name=copyFile>
           <copy todir="directoryName">
                <fileset basedir="bin">
                    <include name="*.dll" />
                </fileset>
           </copy>
    </target>

     

    And you can mention the file name to be \\servername\%GO_PIPELINE_LABEL%\filename.

    Its %GO_PIPELINE_LABEL% and not ${env.GO_PIPELINE_LABEL} as it seems like your on windows.

     

    Thanks,

    Sharanya

  • Avatar
    Devin Quince

    Great, that seems to be working

  • Avatar
    Praveen Rajarao

    Sharanya - I have been reading your comments, and I think you will be able to help me out as well. 

    The Destination directory for my Deployment is a "Read-only" folder. Only one user has write access to that folder. How do i specify a user name to "Run As" in my nant script? 

    Help would be appreciated. Thanks,

    Praveen

  • Avatar
    Srikanth Seshadri

    Hi Praveen,

    You have to use custom command and runas command of windows do it.

    Nant command will not do.

Please sign in to leave a comment.