diskimage-builder/elements/source-repositories
Derek Higgins ef2aa6e8a1 Adding element to get source for elements.
Fixes bug 1184943

Adding an element that allows other elements to register
repositories it would like to be retrieved for it.

Doing this outside of the chroot allows locally cached
repositories to be used. It also gives the ability to d-i-b
to specify what revision to use if an alternative to the
most recent is required.

Effectively allowing a CI system to test d-i-b and elements
without being effected by unavailable git repositories or
breakages in actively developed source code being used by
the elements.

Change-Id: I1527facebaad256a357af680e017b34b1788575d
2013-06-14 18:46:59 +01:00
..
extra-data.d Adding element to get source for elements. 2013-06-14 18:46:59 +01:00
README.md Adding element to get source for elements. 2013-06-14 18:46:59 +01:00

With this element other elements can register source code repositories by placing their details in the file source-repository-*. An example of an element "custom-element" that wants to retrieve the ironic source from git and pbr from a tarball would be

File : elements/custom-element/source-repository-ironic

#<name> <type> <destination> <location> [<ref>]
# <ref> defaults to master if not specified
ironic git /usr/local/ironic git://github.com/openstack/ironic.git

File : elements/custom-element/source-repository-pbr

pbr tar /usr/local/pbr http://tarballs.openstack.org/pbr/pbr-master.tar.gz

diskimage-builder will then retrieve the sources specified and place them at the directory <destination>

A number of environment variables can be set by the process calling diskimage-builder which can change the details registered by the element, these are

DIB_REPOTYPE_<name>     : change the registered type
DIB_REPOLOCATION_<name> : change the registered location
DIB_REPOREF_<name>      : change the registered reference

for example if you would like diskimage-builder to get ironic from a local mirror you could set DIB_REPOLOCATION_ironic=git://localgitserver/ironic.git

Git sources will be cloned to <destination>

Tarballs will be extracted to <destination>. Tarballs should contain a single topleval directory, regardless of the name of this top level directory it will be renamed to <destination>