locked
Using the Same Build Definition for Different Purposes... RRS feed

  • Question

  • Hi there,

    I was wondering if there was a way that I could call a CI set build definition on a nightly, scheduled basis for a slightly different purpose.

    I currently have our Release build definition rolling.  When I get the files deployed to a test server via a PowerShell post build script I run a basic set of ui tests.  The difference I would like in the nightly scheduled build is to run our full UI test suite.  I was hoping to use the same build definition only send a different parameter to the post build script to run the full UI suite of tests.

    Is this possible.

    I've been trying to get a completely different build definition going, but I'm getting The directory name is invalid errors right when it tries to run the pre-build script.  I think there may be some directory adjustments to make in there, but the first thing that script does is write-host source directory and I'm not even getting that far.

    The only real difference between my Release Build Definition and the Nightly definition is that the source mapping is C:\src\MyNet and C:\src\Nightly_MyNet respectively.

    I'm just wondering what the directory error is coming from and why the prebuild script doesn't even seem to be getting to the first command.

    Any guidance appreciated!

    Sunday, November 8, 2015 10:03 PM

Answers

  • So, I rebuilt the definition with a new working directory set to Testxxx (same length) on the agent.  It seemed to work without getting the directory not empty errors on successive builds.

    So, I scraped everything and created another definition, this time with the working directory set back to Nightly = broken again.

    I'm now attempting yet another definition with the working directory set to C:\UI, which seems to be working with early testing.

    Tuesday, November 10, 2015 4:09 PM

All replies

  • In trying to use the separate definition, here's the error I get when the prebuild script tries to run.  The directory listed does appear valid and the script is in that location...

    Sunday, November 8, 2015 10:30 PM
  • I think I may have figured this out somewhat.  I've gotten farther along after changing the working directory in the used Agent's properties.

    I have achieved a successful build after doing so with the separate, Nightly definition.  I can live with scheduling a different definition at night.

    However, when I run the Nightly definition I get a directory is not empty message when it tries to do the Get.  I do have the clean workspace set to true as is the case in my Release build definition.

    If I remove the contents of the nightly work area that build definition will run through to success.  The next successive build request will be met with the directory not empty message. ???

    What the heck is going on!?!?

    Monday, November 9, 2015 1:27 AM
  • Hi NitLions,

    Thanks for your post.

    If you want use multiple build definitions to build the same solution, you should add the $(BuildDefinitionPath) in your build agent’s Working Directory, like: C:\Builds\$(BuildDefinitionPath).


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Monday, November 9, 2015 3:01 AM
    Moderator
  • Yes, it seems that when I changed the agent's working directory to something different I am able to build.  The Release template uses an agent with a working directory of c:\.  This way the source directory falls in line with how we set things up...  C:\src\OurApp.

    Once I set the directory of the agent associated with our Nightly build, it appears I can then build without error - sometimes.  The directory for that build is C:\Nightly\src\OurApp.

    I still can't figure out why I'm getting the directory not empty error.  Is what I've mentioned above not sufficient?

    Monday, November 9, 2015 2:12 PM
  • I wish I could get a grasp on what's going on with my Nightly build and the directory not empty issue.  Basically, the Release and Nightly builds are the same except for running a full UI test suite during the nightly build based on a parameter passed to my post build script.

    I'm having no such issues with my release build and to my knowledge the processes should basically be the same, except for the working directories as set in the agents.

    I'm stumped.

    And, to top it all off, I sometimes see messages that the associated workspace does not exist.  when I look in Source Control Explorer, sure enough, its gone.  If I delete the directory(ies) in question and rebuild, the workspace is once again created.  Not sure what is causing this either.
    • Edited by NitLions Monday, November 9, 2015 3:53 PM additional information
    Monday, November 9, 2015 3:47 PM
  • Here's some additional information, which scares me.

    I thought that I would just create a scheduled task to run a bit before the nightly build to clean the C:\Nightly\src\MyApp work directory.  I thought I would just whip up a PowerShell script to do the job, but when I tested it I was receiving file/path length exception errors.  What was interesting is that when I checked the working directory and strangely enough the residue left behind following the exception error was the same as that left behind when I received directory not empty message during the TFS Build.

    I fiddled around with the directory from the command line to try to remove the directory, but was met with 'directory not empty'

    Is file/path length playing a role here?  I'm hoping that maybe its just the 'widget' or mechanism used to remove or clean the working directory during build that is to blame and that the Gets/Build, etc are not effected or better handled with respect to path lengths.


    • Edited by NitLions Monday, November 9, 2015 6:29 PM additional info
    Monday, November 9, 2015 6:26 PM
  • Hi NitLions,

    It seems that there are something issue during the build.

    1. Are there any error message in the Event Viewer?
    2. Could you reproduce that issue with a new build definition?
    3. What’s the result if you try it with a new team project?

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, November 10, 2015 7:38 AM
    Moderator
  • Hi NitLions,

    It seems that there are something issue during the build.

    1. Are there any error message in the Event Viewer?
    2. Could you reproduce that issue with a new build definition?
    3. What’s the result if you try it with a new team project?

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    I don't see anything of not in the Event Viewer following attempted execution of the problematic definition.  I will try a new build definition with basically the same settings to see if that works.  I don't know that I need to try a new team project because I already have a definition building the same project without issue.

    The only real differences between the two is that the two Agent's used have differing work directories set - Functioning definition/agent = C:\Src\MyApp.  Broken combination = C:\Nightly\Src\MyApp.  The only other difference is a post-script parameter, which indicates the level of UI tests to run.  For the functioning setup, Basic, is passed as the parameter while Full is passed for the broken definition.

    I'm not anywhere near post-script execution so that isn't coming into play yet.

    When you say that it seems there is a problem with the definition are you saying that these long path/directory not empty issues should be taken care of by the TFS Build/definition or they shouldn't effect the build?

    I'm hoping its not a path length issue because the agent work areas only differ by 7 characters, which would mean my Release build may soon be in jeopardy. :{

    Tuesday, November 10, 2015 2:57 PM
  • So, I rebuilt the definition with a new working directory set to Testxxx (same length) on the agent.  It seemed to work without getting the directory not empty errors on successive builds.

    So, I scraped everything and created another definition, this time with the working directory set back to Nightly = broken again.

    I'm now attempting yet another definition with the working directory set to C:\UI, which seems to be working with early testing.

    Tuesday, November 10, 2015 4:09 PM
  • Hi,

    It seems the issue has gone now. If you have that issue again, please feel free to post here or open a new thread.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 11, 2015 6:48 AM
    Moderator