In a team or commercial setting it can be useful to have the code automatically build on a regular basis within your cloud management solution, often as part of continuous integration.
Here we can leverage the Visual Micro Command Line Interface (CLI) on our Build server to build the code, for a variety of boards or debug levels for example.
In this guide we will link to the Azure Dev Ops solution for our code version control and build management.
Admin rights on Cloud System
One project checked in for Build
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Setting Up the Build Dependencies
First we will need to deploy the below items to the build server and set them up:-
It is often best to install these to user independent locations on the Build Server, especially if using the agent as a service on the build server.
Tip - Check you can build a sketch on the build server using the command line at this point, ensure you run it as the user which you will run the build server as.
Step 2: Link and Configure Build Agent
We will need to configure the new Agent in Azure Dev Ops, and configure the Agent on our build server as needed which is detailed below:-
Step 3: Configure Build Pipeline
Now we have an agent ready to build, we will need to configure our pipeline:-
- Create a new blank pipeline
- Ensure the sources are pointing to your checked in project (or GitHub/SVN/Git/Other Source)
- Add a Command line task
- Add commands to run VMBuild.exe as we need
- Add any additional logging to the script (Environmental/user parameters are useful to log for debugging)
You can include pre-defined variables from Azure in your script directly e.g. $(build.sourcesDirectory)
Any further actions such as publishing the artefacts created back to your system can now be added as well.
Step 4: Check Logging
As with all things ensure you have added some informative logging to the whole process.
The Visual Micro Command Line Interface assists with this by adding the below parameters:-
this will ensure all verbose messages are output
this will ensure all verbose warnings are also output
- -builder-close=true and -builder-closeonerrror=true
this ensures the builder exits without need for input from the user
All Visual Micro CLI Parameters can be found here
Step 5: Try It Out
Now you should be able to run a build in your cloud system and see the build process complete!
Its also useful to use the local library cloning, and shared library functions of Visual Micro when integrating with Version Control systems, to keep it as simple and localised as possible for your team, and the build system.
From here you can configure more agents, pipelines and enable the Triggers to automate when your build happens.