summaryrefslogtreecommitdiffstats
path: root/documentation/test-manual/test-manual-understand-autobuilder.rst
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2020-06-26 19:10:51 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-17 10:09:33 +0100
commit9bd69b1f1d71a9692189beeac75af9dfbad816cc (patch)
tree305347fca899074aed5610e0e82eaec180bf630c /documentation/test-manual/test-manual-understand-autobuilder.rst
parentc40a8d5904c29046f1cbbeb998e6cd7c24f9b206 (diff)
downloadpoky-9bd69b1f1d71a9692189beeac75af9dfbad816cc.tar.gz
sphinx: initial sphinx support
This commit is autogenerated pandoc to generate an inital set of reST files based on DocBook XML files. A .rst file is generated for each .xml files in all manuals with this command: cd <manual> for i in *.xml; do \ pandoc -f docbook -t rst --shift-heading-level-by=-1 \ $i -o $(basename $i .xml).rst \ done The conversion was done with: pandoc 2.9.2.1-91 (Arch Linux). Also created an initial top level index file for each document, and added all 'books' to the top leve index.rst file. The YP manuals layout is organized as: Book Chapter Section Section Section Sphinx uses section headers to create the document structure. ReStructuredText defines sections headers like that: To break longer text up into sections, you use section headers. These are a single line of text (one or more words) with adornment: an underline alone, or an underline and an overline together, in dashes "-----", equals "======", tildes "~~~~~~" or any of the non-alphanumeric characters = - ` : ' " ~ ^ _ * + # < > that you feel comfortable with. An underline-only adornment is distinct from an overline-and-underline adornment using the same character. The underline/overline must be at least as long as the title text. Be consistent, since all sections marked with the same adornment style are deemed to be at the same level: Let's define the following convention when converting from Docbook: Book => overline === (Title) Chapter => overline *** (1.) Section => ==== (1.1) Section => ---- (1.1.1) Section => ~~~~ (1.1.1.1) Section => ^^^^ (1.1.1.1.1) During the conversion with pandoc, we used --shift-heading-level=-1 to convert most of DocBook headings automatically. However with this setting, the Chapter header was removed, so I added it back manually. Without this setting all headings were off by one, which was more difficult to manually fix. At least with this change, we now have the same TOC with Sphinx and DocBook. (From yocto-docs rev: 3c73d64a476d4423ee4c6808c685fa94d88d7df8) Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/test-manual/test-manual-understand-autobuilder.rst')
-rw-r--r--documentation/test-manual/test-manual-understand-autobuilder.rst287
1 files changed, 287 insertions, 0 deletions
diff --git a/documentation/test-manual/test-manual-understand-autobuilder.rst b/documentation/test-manual/test-manual-understand-autobuilder.rst
new file mode 100644
index 0000000000..69700088aa
--- /dev/null
+++ b/documentation/test-manual/test-manual-understand-autobuilder.rst
@@ -0,0 +1,287 @@
1*******************************************
2Understanding the Yocto Project Autobuilder
3*******************************************
4
5Execution Flow within the Autobuilder
6=====================================
7
8The “a-full” and “a-quick” targets are the usual entry points into the
9Autobuilder and it makes sense to follow the process through the system
10starting there. This is best visualised from the Autobuilder Console
11view (`https://autobuilder.yoctoproject.org/typhoon/#/console <#>`__).
12
13Each item along the top of that view represents some “target build” and
14these targets are all run in parallel. The ‘full’ build will trigger the
15majority of them, the “quick” build will trigger some subset of them.
16The Autobuilder effectively runs whichever configuration is defined for
17each of those targets on a seperate buildbot worker. To understand the
18configuration, you need to look at the entry on ``config.json`` file
19within the ``yocto-autobuilder-helper`` repository. The targets are
20defined in the ‘overrides’ section, a quick example could be qemux86-64
21which looks like:"qemux86-64" : { "MACHINE" : "qemux86-64", "TEMPLATE" :
22"arch-qemu", "step1" : { "extravars" : [ "IMAGE_FSTYPES_append = ' wic
23wic.bmap'" ] } },And to expand that, you need the “arch-qemu” entry from
24the “templates” section, which looks like:"arch-qemu" : { "BUILDINFO" :
25true, "BUILDHISTORY" : true, "step1" : { "BBTARGETS" : "core-image-sato
26core-image-sato-dev core-image-sato-sdk core-image-minimal
27core-image-minimal-dev core-image-sato:do_populate_sdk", "SANITYTARGETS"
28: "core-image-minimal:do_testimage core-image-sato:do_testimage
29core-image-sato-sdk:do_testimage core-image-sato:do_testsdk" }, "step2"
30: { "SDKMACHINE" : "x86_64", "BBTARGETS" :
31"core-image-sato:do_populate_sdk core-image-minimal:do_populate_sdk_ext
32core-image-sato:do_populate_sdk_ext", "SANITYTARGETS" :
33"core-image-sato:do_testsdk core-image-minimal:do_testsdkext
34core-image-sato:do_testsdkext" }, "step3" : { "BUILDHISTORY" : false,
35"EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; DISPLAY=:1 oe-selftest
36${HELPERSTMACHTARGS} -j 15"], "ADDLAYER" :
37["${BUILDDIR}/../meta-selftest"] } },Combining these two entries you can
38see that “qemux86-64” is a three step build where the
39``bitbake BBTARGETS`` would be run, then ``bitbake
40 SANITYTARGETS`` for each step; all for
41``MACHINE=”qemx86-64”`` but with differing SDKMACHINE settings. In step
421 an extra variable is added to the ``auto.conf`` file to enable wic
43image generation.
44
45While not every detail of this is covered here, you can see how the
46templating mechanism allows quite complex configurations to be built up
47yet allows duplication and repetition to be kept to a minimum.
48
49The different build targets are designed to allow for parallelisation,
50so different machines are usually built in parallel, operations using
51the same machine and metadata are built sequentially, with the aim of
52trying to optimise build efficiency as much as possible.
53
54The ``config.json`` file is processed by the scripts in the Helper
55repository in the ``scripts`` directory. The following section details
56how this works.
57
58.. _test-autobuilder-target-exec-overview:
59
60Autobuilder Target Execution Overview
61=====================================
62
63For each given target in a build, the Autobuilder executes several
64steps. These are configured in ``yocto-autobuilder2/builders.py`` and
65roughly consist of:
66
671. *Run ``clobberdir``*
68
69 This cleans out any previous build. Old builds are left around to
70 allow easier debugging of failed builds. For additional information,
71 see ```clobberdir`` <#test-clobberdir>`__.
72
732. *Obtain yocto-autobuilder-helper*
74
75 This step clones the ``yocto-autobuilder-helper`` git repository.
76 This is necessary to prevent the requirement to maintain all the
77 release or project-specific code within Buildbot. The branch chosen
78 matches the release being built so we can support older releases and
79 still make changes in newer ones.
80
813. *Write layerinfo.json*
82
83 This transfers data in the Buildbot UI when the build was configured
84 to the Helper.
85
864. *Call scripts/shared-repo-unpack*
87
88 This is a call into the Helper scripts to set up a checkout of all
89 the pieces this build might need. It might clone the BitBake
90 repository and the OpenEmbedded-Core repository. It may clone the
91 Poky repository, as well as additional layers. It will use the data
92 from the ``layerinfo.json`` file to help understand the
93 configuration. It will also use a local cache of repositories to
94 speed up the clone checkouts. For additional information, see
95 `Autobuilder Clone Cache <#test-autobuilder-clone-cache>`__.
96
97 This step has two possible modes of operation. If the build is part
98 of a parent build, its possible that all the repositories needed may
99 already be available, ready in a pre-prepared directory. An "a-quick"
100 or "a-full" build would prepare this before starting the other
101 sub-target builds. This is done for two reasons:
102
103 - the upstream may change during a build, for example, from a forced
104 push and this ensures we have matching content for the whole build
105
106 - if 15 Workers all tried to pull the same data from the same repos,
107 we can hit resource limits on upstream servers as they can think
108 they are under some kind of network attack
109
110 This pre-prepared directory is shared among the Workers over NFS. If
111 the build is an individual build and there is no "shared" directory
112 available, it would clone from the cache and the upstreams as
113 necessary. This is considered the fallback mode.
114
1155. *Call scripts/run-config*
116
117 This is another call into the Helper scripts where its expected that
118 the main functionality of this target will be executed.
119
120.. _test-autobuilder-tech:
121
122Autobuilder Technology
123======================
124
125The Autobuilder has Yocto Project-specific functionality to allow builds
126to operate with increased efficiency and speed.
127
128.. _test-clobberdir:
129
130clobberdir
131----------
132
133When deleting files, the Autobuilder uses ``clobberdir``, which is a
134special script that moves files to a special location, rather than
135deleting them. Files in this location are deleted by an ``rm`` command,
136which is run under ``ionice -c 3``. For example, the deletion only
137happens when there is idle IO capacity on the Worker. The Autobuilder
138Worker Janitor runs this deletion. See `Autobuilder Worker
139Janitor <#test-autobuilder-worker-janitor>`__.
140
141.. _test-autobuilder-clone-cache:
142
143Autobuilder Clone Cache
144-----------------------
145
146Cloning repositories from scratch each time they are required was slow
147on the Autobuilder. We therefore have a stash of commonly used
148repositories pre-cloned on the Workers. Data is fetched from these
149during clones first, then "topped up" with later revisions from any
150upstream when necesary. The cache is maintained by the Autobuilder
151Worker Janitor. See `Autobuilder Worker
152Janitor <#test-autobuilder-worker-janitor>`__.
153
154.. _test-autobuilder-worker-janitor:
155
156Autobuilder Worker Janitor
157--------------------------
158
159This is a process running on each Worker that performs two basic
160operations, including background file deletion at IO idle (see `Target
161Execution: clobberdir <#test-list-tgt-exec-clobberdir>`__) and
162maintainenance of a cache of cloned repositories to improve the speed
163the system can checkout repositories.
164
165.. _test-shared-dl-dir:
166
167Shared DL_DIR
168-------------
169
170The Workers are all connected over NFS which allows DL_DIR to be shared
171between them. This reduces network accesses from the system and allows
172the build to be sped up. Usage of the directory within the build system
173is designed to be able to be shared over NFS.
174
175.. _test-shared-sstate-cache:
176
177Shared SSTATE_DIR
178-----------------
179
180The Workers are all connected over NFS which allows the ``sstate``
181directory to be shared between them. This means once a Worker has built
182an artefact, all the others can benefit from it. Usage of the directory
183within the directory is designed for sharing over NFS.
184
185.. _test-resulttool:
186
187Resulttool
188----------
189
190All of the different tests run as part of the build generate output into
191``testresults.json`` files. This allows us to determine which tests ran
192in a given build and their status. Additional information, such as
193failure logs or the time taken to run the tests, may also be included.
194
195Resulttool is part of OpenEmbedded-Core and is used to manipulate these
196json results files. It has the ability to merge files together, display
197reports of the test results and compare different result files.
198
199For details, see `https://wiki.yoctoproject.org/wiki/Resulttool <#>`__.
200
201.. _test-run-config-tgt-execution:
202
203run-config Target Execution
204===========================
205
206The ``scripts/run-config`` execution is where most of the work within
207the Autobuilder happens. It runs through a number of steps; the first
208are general setup steps that are run once and include:
209
2101. Set up any ``buildtools-tarball`` if configured.
211
2122. Call "buildhistory-init" if buildhistory is configured.
213
214For each step that is configured in ``config.json``, it will perform the
215following:
216
217## WRITER's question: What does "logging in as stepXa" and others refer
218to below? ##
219
2201. Add any layers that are specified using the
221 ``bitbake-layers add-layer`` command (logging as stepXa)
222
2232. Call the ``scripts/setup-config`` script to generate the necessary
224 ``auto.conf`` configuration file for the build
225
2263. Run the ``bitbake BBTARGETS`` command (logging as stepXb)
227
2284. Run the ``bitbake SANITYTARGETS`` command (logging as stepXc)
229
2305. Run the ``EXTRACMDS`` command, which are run within the BitBake build
231 environment (logging as stepXd)
232
2336. Run the ``EXTRAPLAINCMDS`` command(s), which are run outside the
234 BitBake build environment (logging as stepXd)
235
2367. Remove any layers added in `step
237 1 <#test-run-config-add-layers-step>`__ using the
238 ``bitbake-layers remove-layer`` command (logging as stepXa)
239
240Once the execution steps above complete, ``run-config`` executes a set
241of post-build steps, including:
242
2431. Call ``scripts/publish-artifacts`` to collect any output which is to
244 be saved from the build.
245
2462. Call ``scripts/collect-results`` to collect any test results to be
247 saved from the build.
248
2493. Call ``scripts/upload-error-reports`` to send any error reports
250 generated to the remote server.
251
2524. Cleanup the build directory using
253 ```clobberdir`` <#test-clobberdir>`__ if the build was successful,
254 else rename it to “build-renamed” for potential future debugging.
255
256.. _test-deploying-yp-autobuilder:
257
258Deploying Yocto Autobuilder
259===========================
260
261The most up to date information about how to setup and deploy your own
262Autbuilder can be found in README.md in the ``yocto-autobuilder2``
263repository.
264
265We hope that people can use the ``yocto-autobuilder2`` code directly but
266it is inevitable that users will end up needing to heavily customise the
267``yocto-autobuilder-helper`` repository, particularly the
268``config.json`` file as they will want to define their own test matrix.
269
270The Autobuilder supports wo customization options:
271
272- variable substitution
273
274- overlaying configuration files
275
276The standard ``config.json`` minimally attempts to allow substitution of
277the paths. The Helper script repository includes a
278``local-example.json`` file to show how you could override these from a
279separate configuration file. Pass the following into the environment of
280the Autobuilder:$ ABHELPER_JSON="config.json local-example.json"As
281another example, you could also pass the following into the
282environment:$ ABHELPER_JSON="config.json /some/location/local.json"One
283issue users often run into is validation of the ``config.json`` files. A
284tip for minimizing issues from invalid json files is to use a Git
285``pre-commit-hook.sh`` script to verify the JSON file before committing
286it. Create a symbolic link as follows:$ ln -s
287../../scripts/pre-commit-hook.sh .git/hooks/pre-commit