Ask a Question

Pull code from repository on VM startup?

SOLVED
MGN
Occasional Contributor

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.

5 REPLIES 5
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


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

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

 

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
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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
MGN
Occasional Contributor

Sounds good, thanks again.  I'll pass this over to the others working on our upgrade to see if this is the solution they were hoping for.

cancel
Showing results for 
Search instead for 
Did you mean: