Jenkins
~~~~~~~

Jenkins information is available on a separate main menu tab.

Any authenticated user can create Jenkins Instances, but only superuser can edit authentication
information required to access Jenkins API and retrieve information about Jenkins slaves. Instances
without authentication information will be skipped during import.

Additionally, Racks configuration directories will be scanned for ``jenkins.yaml`` credentials file.
Using standard settings, Jenkins importer will be looking for ``/etc/racks/jenkins.yaml``.

Sample credentials file content:

.. code-block:: yaml

   - name: Jenkins Sandbox CI
     url: https://jenkins-sandbox.infra.mirantis.net/
     username: <username>
     api_key: <api_key>
   - name: Old Stable CI
     url: https://old-stable-ci.infra.mirantis.net/
     username: <username>
     api_key: <api_key>

Note that username and API key information from credentials file will not be saved in the database.
If a Jenkins Instance with the same URL is already present in the database (possibly with it's own
username and API key), information from credentials file will be used instead and instance name in
the database will be updated from credentials file if necessary.

A configuration setting ``JENKINS_DISABLE_UI_FORMS`` can be set to ``True`` in ``settings.yaml``
file which will disable create/edit/delete functionality in web UI. By default it is set to
``False`` and thus forms are enabled.

Successful import will retrieve information about Jenkins slaves, their respective labels and
some technical information. It will also attempt to link Jenkins slaves to existing inventory
objects, trying to match slave's Hostname value with inventory object name. Import will attempt to
re-use already existing records whenever possible, and will honor existing links between Jenkins
slaves and inventory objects

For situations when automatic match fails, it is possible to manually link Jenkins slaves to
inventory objects.

Established link will show up in detailed view of both Jenkins slave and inventory object.

To retrieve Jenkins slave hostname/IP and assigned labels, Jenkins user needs Administer permissions
to access slave's ``config.xml`` file. The following information is retrieved from ``config.xml``:

- Slave's hostname *or* IP (depending which one is available)
- Labels assigned to this slave

Additional information retrieved about Jenkins slave that doesn't require special permissions:

- Architecture information (text field)
- Online/offline status and reason for being offline (if provided by Jenkins)
- Number of (V)CPUs the slave has
- Disk information (total/temporary disk space)
- Memory information (total/available physical memory, total/available swap memory)
