Reputation: 123
I am currently using Mircosofts Team Foundation Server as a build server via their build agents.
I know that it does provide a REST-API where you can start and see builds and much more.
But is there any possibility to use the build agent from TFS to create a build, exactly like it does if something is committed, without the source being committed into the repository?
I develop apps for mobile where i need to to create an .apk (for example) each time to test a native function. This is done via TFS on check in, but if i am testing something, then i would need to check in like every two minutes and that is not a possibility.
I would need some kind of call, where i can send some kind of zip file or something via a commandline/tool and start the TFS build agents using the files in there.
And i don't want to have two build-services for the different tasks and do not want to install something on local machines (it's in a company).
Does TFS offer a feature like this? Or how would you address this kind of requirements?
Upvotes: 2
Views: 290
Reputation: 114977
You can queue what's known as a "buddy build" or "build with shelveset". You'd shelve your local changes and queue a build which will automatically apply your changes to the current latest version in source control. This will run the build on the standard build server, but doesn't require you to have your changes checked in.
Once satisfied, check-in the code or queue a buddy build with the "Check in if build is successful" option.
The same thing can be accomplished with the new Build in TFS 2015 and VS Team Services, in case you're not using XAML builds.
You can automate the process through a couple of commandline commands (XAML).
tf vc shelve /replace "My local changes"
tfsbuild /start /collection:https://server/tfs/DefaultCollection MyProject MyDefinition
/shelveset:"My local changes" /queue /getoption:latestonbuild
/droplocation:\\your\private\drop\location
I don't think that there is a way to queue a build with shelveset using the existing TFX commandline tools for the new build engine, but it is possible using a little bit of PowerShell to invoke the REST API. Pass the "My Local Changes";yourusername
as sourceBranch
.
You could create a user branch and push that to the server. The commit/push to your own personal branch should pose no issues and you'll have the option to rebase/restructure your user branch prior to merging it with a feature branch.
To build from the commandline you'd use the git executable to commit and push (if you're giving your users permission to force push on their own branch, then you can use amend
and force
:
git commit -m "Testing local changes" [--amend]
git push -u [--force] origin/user/me/testing
Your build would be configured to trigger on your user branch or for all users:
You can specify a branch filter using wildcards, in this case the build will trigger for any branch you create "under" your user.
For added ease you'd grant users permission to rewrite their own branches:
This makes the process almost as lightweight as the TFVC solution. And you'd still need only one build definition to validate all users' branches.
Upvotes: 2