Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for otk-defined distributions (COMPOSER-2299) #797

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Commits on Jul 16, 2024

  1. manifest: make distro field private

    Make the distro field of the manifest.Manifest struct private and make
    sure it's set using the manifest.New() constructor.
    
    The intention is to make manifest.Manifest an interface and getting rid
    of private fields is the first step towards this.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    6bcc552 View commit details
    Browse the repository at this point in the history
  2. manifest: introduce the Manifest interface

    manifest.Manifest is now an interface with one implementation called
    IntManifest (Internal Manifest), which is the previous Manifest type.
    
    All functions that interact with pointers to the old concrete Manifest
    type now interact with the interface instead.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    5606526 View commit details
    Browse the repository at this point in the history
  3. manifest: add OTKManifest type

    The OTKManifest is a second implementation of the manifest.Manifest
    interface that will be used to generate manifests from otk yaml files.
    The type only implements the Serialize() method.  None of the other
    methods are important (at least for now).  The content spec methods in
    particular are not needed since otk will handle content resolution
    (depsolving, container and ostree commit resolves) itself.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    4fcdcd7 View commit details
    Browse the repository at this point in the history
  4. test: add some minimal otk yaml files for testing

    The directory structure follows the assumptions of the test_otk_distro.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    d026031 View commit details
    Browse the repository at this point in the history
  5. pkg: add otkdistro

    New package that loads a distribution from otk yaml files.
    Distribution-level properties, like name, codename, versions, etc, are
    loaded from a file called 'properties.yaml' in the root of the
    distribution's directory.  An error is returned if this file is missing
    or if any of the required properties are undefined/empty.
    
    The distro creates a distro->arch->imagetype hierarchy based on the
    contents of the filesystem tree.  It assumes a directory structure
    `<distroid>/<archname>/<imagetypename>.yaml`.  For example:
    
    fedora-40/
      properties.yaml
      x86_64/
        qcow2.yaml
        ami.yaml
      aarch64/
        qcow2.yaml
    
    The top-level directory is used as the unique distro ID, whereas the
    name is defined in the properties.yaml.  The distinction is useful for
    separating the on-disk, unique ID of a distro from the display name.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    7dbd510 View commit details
    Browse the repository at this point in the history
  6. otkdistro: add a basic distro load test

    Test that the distro is loaded with the expected properties, arches, and
    image types.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    db3ff83 View commit details
    Browse the repository at this point in the history
  7. otkdistro: add DistroFactory()

    Add the DistroFactory() function to otkdistro, which will enable loading
    distros defined using otk files alongside the internally defined ones
    using the same mechanism.
    
    The root of the otk path is hard-coded to "./otk", but we will have to
    make this configurable.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    74c07e8 View commit details
    Browse the repository at this point in the history
  8. distrofactory: add the otkdistro DistroFactory

    With this addition, for every file found in the repository configuration
    path (for this project, "test/data/repositories/" by default), the
    distrofactory will try to load an otk distro at "otk/<distroid>/".
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    b8f887f View commit details
    Browse the repository at this point in the history
  9. manifest: add Blueprint to OTKManifest

    When initialising an OTKManifest, add the Blueprint to it as well, so we
    can create variables (defines, modifications) based on it before
    compiling.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    ac0442a View commit details
    Browse the repository at this point in the history
  10. pkg: add otk for handling otk-related things

    New otk package for managing otk-related things.
    The otkCustomizationsFile type handles creating an otk file with defines
    for customizations and a single otk.include.  The purpose is to use this
    to create a 'customizations.yaml' file that 'otk.define's all the
    variables represented by a blueprint then 'otk.include' the file we want
    to compile, effectively setting variables defined by the user in the
    compilation of the manifest.
    
    Currently it only writes a few simple customizations as a proof of
    concept, but it will grow to cover all potential customizations.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    7cee8d4 View commit details
    Browse the repository at this point in the history
  11. manifest: create customizations file when serializing

    When serializing an OTKManifest, create a customizations file that
    includes 'otk.define's to represent the options of a blueprint, then
    'otk.include' the original entrypoint to generate a manifest with the
    user customizations included.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    ffaa1a6 View commit details
    Browse the repository at this point in the history
  12. otk: add test for customizations file creation

    Define the expected file contents as a map[string]interface{} and
    deserialize the file contents before comparing for convenience and nicer
    error output (compared to strings).
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    23c85bf View commit details
    Browse the repository at this point in the history
  13. manifest: test otk serialization

    Add tests for otk serialization with some simple blueprint
    customizations.
    
    The entrypoint contents and expected serialized manifests are defined as
    map[string]interface for convenience and nicer error output (compared to
    strings).
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    318c8eb View commit details
    Browse the repository at this point in the history
  14. otkdistro: create test distro dynamically

    Remove test/otk/fakedistro and instead create it when running the unit
    test.  This will make it easier to evolve the test to cover more
    features.
    achilleas-k committed Jul 16, 2024
    Configuration menu
    Copy the full SHA
    9b1a67c View commit details
    Browse the repository at this point in the history