.. _configure-manage-worker:

=============================
Configure and manage a worker
=============================

After having set up a new worker, you might want to configure its static metadata
with :ref:`debusine-admin worker edit_metadata <debusine-admin-worker-edit-metadata>`
to alter its behaviour in different ways, as presented in this page.

.. note::

    The examples below always configure only one single aspect and
    use a non-interactive method that overwrites all worker's metadata.
    In practice you will often combine different metadata: you can do that
    either interactively in the text editor that is spawned by
    ``debusine-admin worker edit_metadata`` or you need to provide a YAML file
    combining the different keys if you use the non-interactive approach
    shown in the examples.

Configure the accepted tasks
----------------------------

With an allow list
~~~~~~~~~~~~~~~~~~

You can restrict the list of tasks that are allowed to run on the worker
by providing a list of task names in the ``tasks_allowlist`` metadata:

.. code-block:: console

  $ cat > /tmp/metadata <<END
  tasks_allowlist:
  - sbuild
  - lintian
  END
  $ sudo debusine-admin worker edit_metadata \
    debusine-internal --set /tmp/metadata

.. note::

   Task names are lowercased compared to the names shown in the
   :ref:`tasks reference list <task-reference>`.

With a deny list
~~~~~~~~~~~~~~~~

You can allow all tasks except a few exceptions by providing the list of
forbidden tasks in the ``tasks_denylist`` metadata.

.. code-block:: console

  $ cat > /tmp/metadata <<END
  tasks_denylist:
  - sbuild
  - simplesystemimagebuild
  END
  $ sudo debusine-admin worker edit_metadata \
    debusine-internal --set /tmp/metadata

.. _howto-configure-worker-architectures:

Configure the list of compatible architectures
----------------------------------------------

For tasks that have architecture requirements, by default, a worker will
only run those which its kernel declares support for (as determined by
``arch-test -n``).

Most typical installations will be able to execute variants of the
native architecture:

* ``amd64`` workers will accept tasks for ``amd64`` and ``i386``.
* ``arm64`` workers (with 32-bit support) will accept tasks for
  ``arm64``, ``armhf``, and ``armel``.

It is possible to configure a worker to accept tasks for other
architectures by providing ``worker:build-arch:ARCH`` tags in the
worker's static metadata, assuming the tasks can run with the help of
``qemu-user-static`` or similar.

.. code-block:: console

  $ cat > /tmp/metadata <<END
  provided_tags:
  - worker:build-arch:loong64
  END
  $ sudo debusine-admin worker edit_metadata \
    debusine-internal --set /tmp/metadata
