Forum Discussion

MGN's avatar
MGN
Occasional Contributor
5 years ago
Solved

Pull code from repository on VM startup?

Hello Everyone,

 

I tried doing some searching, but wasn't able to find help related to what we're trying to do with a new VM setup. 

 

We are currently being upgraded to new windows 10 vm's with the plan that we will have one master that all of our test runner machines will be created from on start/restart.  Once the vm's are created, they will just have the software installed we need to run our tests through TestExecute.  When a vm is restarted, it will then be re-built each time from the master to try and keep the machine as clean as possible.

 

The part we're trying to figure out is how we can on vm startup pull code from our TFS repository so the VM has the latest version of code to run tests/processes we use it for.  This restart would most likely happen over the weekend and we have processes that run daily early in the morning (2 AM) that would need this code to be able to run when no one is there to push code to the vm.  In our current setup, we are able to copy code manually down to our VM's that are not rebuilt upon a restart and thus keep the code necessary to run day to day.

 

Any suggestions on how to approach this are appreciated, thanks.

  • We're using a commandline call in Task Scheduler.  We have ours triggered on a timer but you can trigger off of logon or startup.

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe" get *.* /force /recursive

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    We're using a commandline call in Task Scheduler.  We have ours triggered on a timer but you can trigger off of logon or startup.

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe" get *.* /force /recursive

    • Marsha_R's avatar
      Marsha_R
      Champion Level 3

      At a previous job, we did something similar to what tristaanogre describes, but we used Bamboo to launch everything.  

       

    • MGN's avatar
      MGN
      Occasional Contributor

      Thanks for the quick reply.

       

      From the command line code listed there, aside from needing a version of visual studio installed on the VM, I'm guessing you need to have an account logging in to the VM that has access to the TFS repository and has mapping defined to pull to a location (in this case, defined on the master vm so it exists on runner vm creation/recreation), yes?  Or is it possible in the command line string to define permissions and the folder location to write the code to?  Our test user for our vm's currently doesn't have access to our repository since we've only manually pushed code to the vm's so far.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You are correct, you will need to set up that test user to have at least a level of access to retrieve from the repository.