This project allows to automate builds for fullmetalupdate. Each time there is a change in a branch the repository https://github.com/FullMetalUpdate/meta-fullmetalupdate-extra, a build will be triggered for all machines which depend of this branch.
This project is using buildbot, running in docker containers. For more documentation about buildbot go to https://docs.buildbot.net/current/tutorial/docker.html.
The particularity of docker in this project is that the buildbot worker container has to run a container from FMU. We are therefore using DooD (Docker outside of Docker) by bind-mounting host docker socket. Be aware that containers will be able to start “sibling” containers and not child containers (which can cause volume mouting, device access and network problems). More information on DooD at https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/.
This project has only been tested on Linux, but given that all is running in containers that shouldn't be an issue.
The deployment testing is performed thanks to Witekio Automation Lab, interfaced through the farm-core API which is still in developpement and internal to Witekio (for now).
You must have install all dependencies of FullMetalUpdate. To see all dependancies have a look at https://www.fullmetalupdate.io/docs/documentation/.
You have also to additionnaly install docker-compose:
pip install docker-compose
Test if docker is running:
sudo docker run -i busybox /bin/echo Success
You first have to start the FMU cloud server. This server has to be running because all builds performed with FMU need to push them to the cloud server.
The start the cloud server please read the "Set up the server" section on the documentation of fullmetalupdate on https://www.fullmetalupdate.io/docs/documentation/.
In a working directory, use git to download the project
$ git clone https://github.com/lquinet/fmu-automation-build.git
$ cd fmu-automation-build
Before launching buildbot you have to configure some variables. All important variables are defined in the .env file.
All variables related with the build of the images
hostname command.All variables related with the automation lab infrastructure.
Credentials to a witekio bitbucket account in order to access to farm-core repo which is a private repo (for now).
All variables related with buildbot config.
All variables in order to provide access to the reporters. Reporters are the means to nofity developpers and team members about the status of the builds.
Once you have done it, you can launch buildbot:
$ cd docker
$ docker-compose up
You should now be able to go to http://localhost:8010, where you will see a web page similar to:

The deployment testing is performed thanks to Witekio Automation Lab, interfaced through the farm-core API which is still in developpement and internal to Witekio (for now).
Deployment is tested by simply flash DUT SD card via SDWire and check boot string via DUT serial interface. The boot is considered successfull if the boot string "login :" is found in the boot string.
The project has been tested for raspberry pi 3 B+. The hardware has been set up as follow:
For now it is only possible to test one DUT at a time. You have manuallyt indicate the path of the SD card plugged in thanks to SDWire. You have also to enter the PDU acces in order to control the supply of the DUT (for the moment only APC type of PDU is supported).
A reporter is configured to publishes build status using GitHub Status API. In order to use it, you have to provide a token to your GitHub account via the GITHUB_TOKEN variable in the .env file. To get a token on GitHub go to https://github.com/settings/tokens and click on "Generate new token". Be sure to enable enough scopes for your personnal token.
Once you have provided it, you should see build status appearing on your commits like that:

The CI badge of all builders are available at http://<buildbotURL>/badges/<buildername>.svg.

You can sends messages to a Slack channel when each build starts / finishes with a handy link to the build results.
This is performed thanks to the incoming webhook feature of slack apps. All you have to do is to provide a webhook url by setting the SLACK_WEBHOOK_URL variable in the .env file.
To get a webhook you cal follow this tutorial: https://api.slack.com/tutorials/slack-apps-hello-world.
The slack integration in buildbot has been done thanks to the non official buildbot plugin buildbot-slack.
Here is a preview of the slack integration:

You can send email when builds finish. The way it has been configured in buildbot is to send a mail to developers who made the change in the repo which triggered the build in buildbot.
This has only been tested with office 365 addresses but more configurations are supported.
In order to make it works you have to configure several variables in the .env file. You have to provide a mail address from which all mails are sent (MAIL_FROM_ADDR). You also have to indicate the parameters related with the stmp server:
Typical config for office 365 mail is SMTP_ENCRYPTION=STARTTLS ; SMTP_PORT=587 and requires SMTP_USER and SMTP_PWD which are login and password of the mail account related to MAIL_FROM_ADDR.
If you want to customise the behavior of buildbot, you have to modify the master.cfg file.
In this file you can modify workers behavior, changes sources, schedulers, builders, and so on.
There are some custom variables:
"build_branch" means that a change in a branch of the repo will trigger the build for the supported machines for this branch. Be carefull it has to be a Yocto branch supported by FMU."build_all" means that a change in the branch "master" of this repo will trigger the build of all machine/branch combinations.# Custom variables
REPOS_TO_TRACK = {
"https://github.com/lquinet/meta-fullmetalupdate-extra.git" : "build_branch",
"https://github.com/lquinet/meta-fullmetalupdate.git" : "build_branch",
"https://github.com/lquinet/fullmetalupdate.git" : "build_all",
"https://github.com/lquinet/fullmetalupdate-yocto-demo.git" : "build_all",
}
SUPPORTED_MACHINES_ROCKO=["imx6qdlsabresd", "raspberrypi3"]
SUPPORTED_MACHINES_THUD=["imx8mqevk", "stm32mp1-disco"]
SUPPORTED_MACHINES_WARRIOR=["imx8mqevk"]
BRANCH_MACHINE_PAIRS = {
"rocko" : SUPPORTED_MACHINES_ROCKO,
"thud" : SUPPORTED_MACHINES_THUD,
"warrior" : SUPPORTED_MACHINES_WARRIOR,
}
YOCTO_REPO_URL="https://github.com/lquinet/fullmetalupdate-yocto-demo.git"
The docker-compose.yml file depends on the .env file.
You can directly change the parameters of buildbot containers by modifying docker-compose.yml.
from farmcore import Hub
Hub(...).get_block()
Hub(...).get_part()
replace ... with the USB path of course (can probably just use 'usb1' if you don't know the USB path of the hub)
get_block() will find you block devices
get_part() will find you partitions
Both will return a data structure with the device file path in it. You can get it to give you only the device file path by doing: Hub(...).get_block('devnode')
All of the Hub's get_xxx methods search the downstream USB tree for devices of a certain type, and return a data structure containing lots of info about them. By default you only get the first matching one found, but you can pass another argument all=True to get a list of everything found that matches if needed
Content type
Image
Digest
Size
406.5 MB
Last updated
over 6 years ago
docker pull lquinet/buildbot-worker