"Perform a ""clean checkout"" when the materials are downloaded"

Comments

3 comments

  • Avatar
    janmejay

    Hi Stuart,


    We don't support 'cleanCopy' equivallent currently.  


    However, the agents do perform an 'svn clean' and 'svn update' which means unversioned files will be removed, as long as these are not 'svn ignored'. 


    A workaround you can use for cleanup of ignored files is manually uploading artifacts using cruise APIs, and then delete the working directory in a subsequent task.


    For instance, the config snippet may look similar to this


    <tasks>
      <exec command="do_something" workingdir="work_dir" />
      <exec command="/bin/sh" args="-c curl -X POST http://user_name@password@cruise_server_host_name:8153/cruise/files/$CRUISE_PIPELINE_NAME/$CRUISE_PIPELINE_COUNTER/$CRUISE_STAGE_NAME/$CRUISE_STAGE_COUNTER/$CRUISE_JOB_NAME/some_dir/some_file -F file=@some_file_header" workingdir="work_dir" />
      <exec command="/bin/sh" args="-c curl -X PUT http://user_name@password@cruise_server_host_name:8153/cruise/files/$CRUISE_PIPELINE_NAME/$CRUISE_PIPELINE_COUNTER/$CRUISE_STAGE_NAME/$CRUISE_STAGE_COUNTER/$CRUISE_JOB_NAME/some_dir/some_file -F file=@some_file_content" workingdir="work_dir" />
      <exec command="rm" args="-rf work_dir" />
    </tasks>



    This uses regular exec tasks to upload artifacts, and then the last task does cleanup. The next time this job runs on this agent, it will get a clean directory to work with.


    Regards,
    Janmejay
    (Cruise team)

    0
    Comment actions Permalink
  • Avatar
    Slange

    Thanks for your response.


    I'm not aware of an "svn clean" command.  Assuming you are talking about "svn cleanup", that command handles removing locks that are in a bad state and cleans up aborted operations (http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.cleanup.html).  It does not delete unversioned files.


    In practice with Cruise, I am seeing unversioned files that are created by the previous build present in the subsequent build's working copy.


    Deleting the working copy after the build is a decent workaround, but I would prefer that the build delte the working copy at the beginning of the process, before checking out the materials.  Is there any way to configure such a pre-build step in Cruise today?


    I would still strongly encourage the addition of "cleanCopy" support in Cruise.


    Thanks for your help!

    0
    Comment actions Permalink
  • Avatar
    janmejay

    Hi Stuart,


    Sorry "svn clean" was a mistake, i meant "svn cleanup".


    We don't support it as a pre-material-update step. However, since the files in question are unversioned, you can run a different task that performs cleanup as pre-build step(but after material update). For instance the command below would delete all unversioned files.


    svn st | grep -F ? | awk '{print $2}' | xargs rm 


    This however has the problem of a new upstream revision adding a file which agent checkout already has(as an unversioned file). Which can result in a conflict situation. I guess the best workaround is to remove working directory as the last task executed.


    We do not have any plans to support cleanCopy as of now, however we may consider the possibility of adding it to one of the future releases.

    0
    Comment actions Permalink

Please sign in to leave a comment.