Andaman

From Fyra Wiki
Revision as of 10:37, 12 June 2023 by Madomado (talk | contribs) (→‎Terra: fix wrong repo url in note)
Jump to navigation Jump to search

Andaman, often abbreviated as anda, is a modern package build toolchain designed to simplify building different package formats for different projects in the same repository. It mainly supports monorepo setups, especially ones with CI support like GitHub. It currently supports building RPMs, OCI images and Flatpak packages. It is written by Fyra Labs with the Rust programming language.

Anda's simplicity makes the packaging process seamless and it is most notably used in Terra.

Mechanisms

Currently, Anda is simply a meta-build system that calls upon other build systems to build and distribute packages. It reads the project manifest in anda.hcl and calls the corresponding build system to build the package. Multiple projects can be included in a single repository (known as a monorepo) recursively in different directories. The root directory contains a main configuration file (also anda.hcl) and the configurations will be inherited. All the other anda.hcl files in its subdirectory can independently represent multiple projects, and multiple ways to build a package can be specified in each project. Once properly configured, a project can be built by anda build subdirectory_path/project_name.

AndaX

AndaX is an embedded scripting system powered by Rhai. It is mainly for supporting automatic updates, but it is also the scripting system used behind pre_script and post_script.

Automatic Updates

See also: Fyra Developer: Terra autoupdate for the supported functions in AndaX

Anda has refined support over automatically updating packages via the anda update command. The command finds all the projects with the file update.rhai in the same directory or if the configuration file has the update property set to a value:

project project_name {
  update = "path/to/update_script.rhai"
  labels {
    a = "1"
  }
}

Then, AndaX executes the script. Projects can also be filtered by adding --filters key=value,key2=value2 to the command. For example, the update script for the above project will be executed for --filters a=1 or even without filters related to a, but it won't be executed for --filters a=2.

Configuration

Andaman uses the HashiCorp Configuration Language (HCL) for its configuration format, known for being used in software by HashiCorp such as Terraform, Consul, Vault and Packer. Its syntax is similar to UCL and NGINX's configuration format.

Consider the following. for { } and "", they represent, respectively, an dictionary (empty by default) with keys and string values, and a string with no default value. Unless otherwise stated, all the attributes are optional.

config {
  mock_config = "" // default mock config for `anda build -c custom_mock_config`
  strip_prefix = "" // strip prefix to form new project alias
  strip_suffix = "" // strip suffix to form new project alias
  project_regex = ""
}
project "project_name" { // the string quote is optional
  rpm {
    spec = "path/to/file.spec" // REQUIRED
    sources = "."
    package = ""
    pre_script = "rpm_pre.rhai"
    post_script = "rpm_post.rhai"
    mock_config = ""
    enable_scm = false
    scm_opts { }
    config { }
    plugin_opts { }
    macros { }
    opts { }
  }
  podman tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  docker tagname {
    dockerfile = ""
    import = ""
    tag_latest = false
    context = "" // REQUIRED
    version = ""
  }
  flatpak {
    manifest = "path/to/manifest.yml" // REQUIRED
    pre_script = ""
    post_script = ""
  }
  pre_script = "pre.rhai"
  post_script = "post.rhai"
  env { }
  alias = [] // array of strings
  scripts = [] // array of paths to AndaX scripts
  labels { }
  update = "update.rhai"
  arches = ["x86_64", "aarch64"]
}

History

umpkg

In the very beginning, the Ultramarine Project had been using Koji for building RPM packages. Koji is the packaging system used by the Fedora Project. However, Koji's sophistication makes it difficult to create and maintain RPM packages — it was said that the only person in the Ultramarine team who actually knew how to use Koji was the lead developer, Cappy Ishihara. Cappy was annoyed by the sheer complexity of building and uploading packages to Koji and made umpkg, a packaging toolchain that runs on Mock and Koji. The creation of umpkg made it easier to create and maintain packages. However, umpkg still tightly integrates with Koji and uses the Koji API to trigger builds. Thus, an entirely new CI server was proposed.

RPM Frontend

The Ultramarine Project started work on Andaman on 9 Jun, 2022. The name Andaman refers to the Andaman Sea next to Thailand, and follows the naming patterns for other projects related to Ultramarine. Initially, Anda was written as a custom RPM frontend as an alternative to DNF that is similar to that of an AUR helper. However, there were issues with rust and RPM support.

CI Server

Anda was then rewritten as a CI Server that handles builds via BuildKit, stores artifacts and build infos, and later included a frontend to the server. However, it slowly turned into a massive feature creep of projects.

Final rewrite

Thus, Anda was rewritten again and it finally became a build system for various package formats.

Terra

Main Article: Terra

After the creation of Anda, the Ultramarine Project has migrated their repositories into GitHub monorepos. However, a repository containing packages for not only Ultramarine Linux, but also all other Fedora distributions was wanted so that packages can be shared between both Ultramarine Linux and TauOS, which led to the creation of the Andaman Common Repositories, also known as the Andaman Subatomic Repositories.[note 1] It was later renamed to Terra, and now contains many common packages not found in the Fedora repositories.

Notes

  1. The original GitHub organisation was called "andaman-common-pkgs", and the original repository url was https://subatomic.fyralabs.com/ad37/.

See Also