Skip to content

Commit 5d7bae3

Browse files
Martin BastiMartinBasti
authored andcommitted
Add Hermeto
Hermeto is another method for remote sources Signed-off-by: Martin Basti <mbasti@redhat.com>
1 parent 9de4fd3 commit 5d7bae3

2 files changed

Lines changed: 87 additions & 29 deletions

File tree

docs/admins.rst

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ allowed_attributes
489489

490490
.. _cachito-integration:
491491

492-
Cachito integration
493-
-------------------
492+
Cachito/Hermeto integration
493+
---------------------------
494494

495495
cachito_ caches specific versions of upstream projects source code along with
496496
dependencies and provides a single tarball with such content for download upon
@@ -500,13 +500,17 @@ handling the source code for a third party (e.g., if tracking is performed in
500500
an external git forge, someone could force push a change to the repository or
501501
simply delete it).
502502

503-
OSBS is able to use cachito to handle the source code used to build a container
504-
image. The source code archive provided by cachito and the data used to perform
505-
the cachito request may then be attached to the koji build output, making it
503+
hermeto_ is successor of Cachito, it's a CLI tool, not a service like Cachito,
504+
that resolves dependencies to provide data for hermetic builds. Unfortunately
505+
Hermeto doesn't do Caching.
506+
507+
OSBS is able to use Cachito or Hermeto to handle the source code used to build a container
508+
image. The source code archive provided by Cachito/Hermeto and the data used to perform
509+
the Cachito/Hermeto request may then be attached to the koji build output, making it
506510
easier to track the components built in a given container image.
507511

508-
This section describes how to configure OSBS to use cachito as described above.
509-
:ref:`cachito-usage` describes how to get OSBS to use cachito in
512+
This section describes how to configure OSBS to use Cachito/Hermeto as described above.
513+
:ref:`cachito-usage` describes how to get OSBS to use Cachito/Hermeto in
510514
a specific container build, as an OSBS user.
511515

512516
.. _configure-cachito-instance:
@@ -527,6 +531,25 @@ Example:
527531
auth:
528532
ssl_certs_dir: /dir/with/cert/file
529533
534+
Configuring Hermeto
535+
~~~~~~~~~~~~~~~~~~~
536+
537+
To enable Hermeto, you should provide Hermeto container images into pipelineRun
538+
template parameter ``hermeto-image``
539+
540+
541+
Choosing default provider for remote sources
542+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
543+
You can configure if Cachito (number 1) or Hermeto (number 2) should be
544+
the default method for remote sources.
545+
546+
.. code-block:: yaml
547+
548+
remote_sources_default_version: 1
549+
550+
551+
552+
530553
.. _allow-multiple-remote-sources:
531554

532555
Allowing multiple remote sources
@@ -547,8 +570,8 @@ Configuring koji
547570
Adding remote-sources BType
548571
''''''''''''''''''''''''''''
549572

550-
To fully support cachito_ integration, as described in
551-
:ref:`cachito-integration`, the `remote-sources`
573+
To fully support cachito_ integration or hermeto_ integration,
574+
as described in :ref:`cachito-integration`, the `remote-sources`
552575
BType must be created in koji. This is done by running
553576

554577
.. code-block:: shell
@@ -563,7 +586,8 @@ atomic-reactor. This JSON file includes information such as the repository from
563586
where cachito downloaded the source code and the revision reference that was
564587
downloaded (e.g., a git commit hash).
565588

566-
.. _cachito: https://github.com/release-engineering/cachito
589+
.. _cachito: https://github.com/containerbuildsystem/cachito
590+
.. _hermeto: https://github.com/hermetoproject/cachi2
567591

568592

569593
Obtaining Atomic Reactor stack trace

docs/users.rst

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -650,13 +650,50 @@ available and in the PATH for the builder image, or an error will result.
650650

651651
.. _cachito-usage:
652652

653-
Fetching source code from external source using cachito
654-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
653+
Fetching source code from external source
654+
-----------------------------------------
655+
656+
OSBS allows multiple providers for remote sources, namely Cachito and Hermeto.
657+
658+
Users can chose which provider to use by configuration in ``container.yaml``:
659+
660+
.. code-block:: yaml
661+
662+
---
663+
remote_sources_version: 2
664+
665+
666+
.. list-table:: Remote source provider
667+
:widths: 25 25
668+
:header-rows: 1
669+
670+
* - Provider
671+
- Numerical value
672+
* - Cachito
673+
- 1
674+
* - Hermeto
675+
- 2
676+
677+
678+
When ``remote_sources_version`` isn't provided, default version will be used.
679+
This is configurable by admins.
680+
681+
Cachito
682+
~~~~~~~
655683

656684
As described in :ref:`cachito-integration`, it is possible to use cachito to
657685
download a tarball with an upstream project and its dependencies and make it
658686
available for usage during an OSBS build.
659687

688+
.. note:: In order for these entries to be used, both OSBS Cachito integration and usage
689+
of ``remote_sources`` need to be allowed in the OSBS Instance configuration. See
690+
:ref:`configure-cachito-instance` and :ref:`allow-multiple-remote-sources`.
691+
692+
Hermeto
693+
~~~~~~~
694+
695+
Hermeto runs as part of OSBS pipeline, it's not an external service.
696+
For compatibility reasons, majority of options are same as with Cachito.
660697

661698
remote_sources
662699
~~~~~~~~~~~~~~
@@ -665,9 +702,7 @@ A list of remote_source maps, each with an additional name parameter. For each
665702
remote_source, OSBS will request a source archive bundle from cachito. The keys
666703
accepted here are described below.
667704

668-
.. note:: In order for these entries to be used, both OSBS cachito integration and usage
669-
of remote_sources need to be allowed in the OSBS Instance configuration. See
670-
:ref:`configure-cachito-instance` and :ref:`allow-multiple-remote-sources`.
705+
671706

672707
name
673708
Serves as a unique identifier for the remote source.
@@ -685,21 +720,20 @@ remote_source
685720

686721
pkg_managers
687722
A list of package managers to be used for resolving the upstream project
688-
dependencies. If not provided, Cachito will assume ``gomod`` due to backward
723+
dependencies. If not provided, Cachito/Hermeto will assume ``gomod`` due to backward
689724
compatibility reasons, however, this default could be configured differently
690725
on different Cachito deployments (make sure to check with your Cachito
691-
instance admins). Finally, if this is set to an empty array (``[]``), Cachito
726+
instance admins). Finally, if this is set to an empty array (``[]``), Cachito/Hermeto
692727
will provide the sources with no package manager magic. In other words, no
693728
environment variables, dependencies, or extra configuration will be provided
694729
with the sources.
695730

696-
The full information about supported package managers is in the
697-
`upstream Cachito package manager documentation
698-
<https://github.com/release-engineering/cachito#package-managers>`_.
731+
Supported package managers are: ``gomod``, ``rubygems``, ``pip``, ``yarn``,
732+
``npm``, ``git-submodule``
699733

700734
flags
701-
List of flags to pass to the cachito request. See the cachito_ documentation
702-
for further reference.
735+
List of flags to pass to the Cachito/Hermeto request.
736+
See the cachito_ and hermeto_ documentation for further reference.
703737

704738
packages
705739
A map of package managers where each value is an array of maps describing
@@ -738,11 +772,11 @@ where ``{name}`` refers to the name of a given remote source as defined in conta
738772
The dependencies can be correspondingly found at ``$REMOTE_SOURCES_DIR/{name}/deps``
739773

740774
OSBS also creates a ``$REMOTE_SOURCES_DIR/{name}/cachito.env`` bash script with exported
741-
environment variables received from each cachito request (such as ``GOPATH``,
775+
environment variables (such as ``GOPATH``,
742776
``GOCACHE`` for gomod package manager and ``PIP_CERT``, ``PIP_INDEX_URL`` for pip).
743777
Users should use the following command in the Dockerfile to set all required variables::
744778

745-
RUN source $REMOTE_SOURCES_DIR/{name}/cachito.env
779+
RUN source $REMOTE_SOURCES_DIR/{name}/cachito.env # filename is compatible with Hermeto
746780

747781
Note that ``$REMOTE_SOURCES_DIR`` is a build arg, available only in build time.
748782
Hence, for cleaning up the image after using the sources, add the following
@@ -751,15 +785,14 @@ line to the Dockerfile after the build is complete::
751785
RUN rm -rf $REMOTE_SOURCES_DIR
752786

753787
``$REMOTE_SOURCES`` is another build arg, which points to the directory that
754-
contains extracted tar archives provided by cachito in the buildroot workdir.
788+
contains extracted remote source tar archives in the buildroot workdir.
755789

756-
.. note:: To better use the cachito provided dependencies, a full gomod
757-
supporting Golang version is required. In other words, you should use Golang
758-
>= 1.13
759790

760791
Replacing project dependencies with cachito
761792
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
762793

794+
.. note:: Hermeto doesn't support replacements.
795+
763796
Cachito also provides a feature to allow users to replace a project's
764797
dependencies with another version of that same dependency or with a completely
765798
different dependency (this is useful when you want to use a patched fork for a
@@ -797,7 +830,8 @@ parameters, the same option should be specified multiple times in ``koji`` or
797830
the ``osbs`` CLI. This was done to keep the consistency with the similar option
798831
to specify yum repository URLs in each particular CLI.
799832

800-
.. _cachito: https://github.com/release-engineering/cachito
833+
.. _cachito: https://github.com/containerbuildsystem/cachito
834+
.. _hermeto: https://github.com/hermetoproject/cachi2
801835

802836
.. _content_sets.yml:
803837

0 commit comments

Comments
 (0)