README.rst
====
koji-atomic-reactor-plugin
====

**THIS IS A PROOF OF CONCEPT NOT MEANT FOR PRODUCTION USE**

``koji-atomic-reactor-plugin`` is a plugin to koji_ that enables builders to
execute docker_ layered image builds using atomic-reactor_.

The builders need to have both docker_ and atomic-reactor_ installed with the
docker_ service enabled.

Place the ``atomicreactor.py`` in ``/usr/lib/koji-builder-plugins/``, edit the
koji builder config file, ``/etc/kojid/kojid.conf`` and enable it:

::

    # A space-separated list of plugins to enable
    plugins = atomicreactor

Restart the Koji Builder service, and your plugin will be enabled.

Now you can run the task with the koji client:

::

    $ koji make-task atomicreactor \
        buildroot \
        "https://github.com/maxamillion/atomic-reactor-dockerfile-test.git" \
        test-image

    # You can optionally pass in a git commit, branch, or tag
    $ koji make-task atomicreactor \
        buildroot \
        "https://github.com/maxamillion/atomic-reactor-dockerfile-test.git" \
        test-image \
        my-git-topic-branch



Builder Pre-Reqs
----------------

On the builder, you need to have atomic-reactor_ installed which can be found
for the time being in a COPR_ here: maxamillion-atomic-reactor_

Currently you also need to alter python-requests version
(EL7-requests_ and Fedora-requests_)

::

    # For RHEL7 or derivative distros such as CentOS7
    $ yum -y install atomic-reactor
    $ yum -y update python-requests

    # For Fedora
    $ dnf -y install atomic-reactor
    $ dnf -y downgrade python-requests

Also need to have docker installed and running on the build system. Please note
recomendations about docker-storage_ for production systems.

::

    # For RHEL7 or derivative distros such as CentOS7
    #
    ## NOTE: RHEL7 systems need the optional channel enabled in 
    ##       subscription-manager
    $ yum -y install docker
    $ systemctl docker start

    # For Fedora
    $ dnf -y install docker
    $ systemctl docker start

Then we need to build the buildroot image for atomic-reactor_

::

    $ atomic-reactor create-build-image --reactor-tarball-path /usr/share/atomic-reactor/atomic-reactor.tar.gz /usr/share/atomic-reactor/images/dockerhost-builder buildroot

We are now ready to build!


.. _koji: https://fedoraproject.org/wiki/Koji
.. _atomic-reactor: https://github.com/projectatomic/atomic-reactor
.. _docker: https://github.com/docker/docker
.. _COPR: https://fedorahosted.org/copr/
.. _maxamillion-atomic-reactor: https://copr.fedoraproject.org/coprs/maxamillion/atomic-reactor/
.. _EL7-requests: https://github.com/projectatomic/atomic-reactor/issues/225
.. _Fedora-requests: https://github.com/projectatomic/atomic-reactor/issues/226
.. _docker-storage: http://www.projectatomic.io/blog/2015/06/notes-on-fedora-centos-and-docker-storage-drivers/