One of the features that I love the most about Visual Studio Team Services is the ability to build my code in the cloud. In my project I have a requirement for dynamic build provisioning, which works well. However, I recently tried to figure out how can I get the list of steps from a build definition, and was hitting a roadblock up until I got some help from Chris Patterson.
Written to the tune of:
A while ago Microsoft released this wonderful thing called the VSO agent – a cross-platform build agent that you can set up on MacOS X and/or Linux and hook it directly to a VSO or TFS instance to handle automated builds with a lot of customization options. You can get it here.
So here comes the challenge – more often than not, the build agent should be automatically set up, but the documentation mentions that the instance details, such as the service URL, username and password are manually entered. Not exactly what you want to do in an automated scenario. The good news is that there is a (not so) secret option to use command line parameters for the vso-agent:
node agent/vsoagent.js --u YOUR_USERNAME --p VSO_ONE_USE_TOKEN --s https://VSO_URL.visualstudio.com --a AGENT_NAME --l AGENT_POOL_CAN_BE_DEFAULT
Voila! All of a sudden, you can include this in your deployment scripts.