Skip to content

Configuring the image

The image is configured using a YAML configuration file and the apm system image build command.

Basic config

The initial file from which the configuration starts is /etc/apm/image.yml.

apm system image build applies changes to the current container based on the settings in image.yml.

Clarification

When creating an image in CI/CD, the configuration file is copied or mounted using Containerfile from the repository to the container via the aforementioned path.

Example

ALT Atomic Core:

yml
image: ${{ Env.IMAGE }}

modules:
  - name: Set repos
    type: repos
    body:
      branch: sisyphus
      date: ${{ Env.YEAR }}/${{ Env.MONTH }}/${{ Env.DAY }}
      clean: true

  - type: packages
    body:
      update: true
      upgrade: true

  - name: Set branding
    type: branding
    body:
      name: alt-atomic-${{ Env.IMAGE_NAME }}
      build-type: ${{ Env.IMAGE_TYPE }}

  - name: Copy root
    type: copy
    body:
      source: root
      destination: /
      replace: true

  - type: include
    body:
      targets:
        - packages.yml
        - network.yml
        - apt-rpm.yml
        - filesystem.yml
        - systemd.yml
        - settings.yml
        - passwd.yml
        - disable-bins.yml

  - name: Configurate grub
    type: shell
    body:
      command: scripts/grub.sh

  - name: Update kernel
    type: kernel
    body:
      flavour: 6.12
      modules:
        - drm
      rebuild-initrd-method: dracut

  - name: Cleanup
    type: include
    body:
      targets:
        - cleanup.yml

Fields of the configuration file

Legend

! — required field

FieldDescription
imageBase image to use (reference to the container).
modulesList of modules.
envEnvironment variables. Can be used in any module.

image is a required field when using apm s i apply or apm s i update.

Modules (modules)

Array of modules for execution.

FieldDescription
nameThe name of the module for logging.
typeThe type of the module body.
idThe module identifier. For more details, see the section "Module Identifier".
envEnvironment variables for the module. They can only be used within the scope of this module.
ifCondition in the Expr language format.
bodyModule body.
outputData for output.

The identifier allows you to access the module to obtain the values of the following fields:

  • Name (name)
  • Type (type)
  • Identifier (id)
  • Result of the conditional expression (if)
  • Output data (output)

Branding (branding)

The branding module is designed to select the branding for the installed image.

FieldDescription
nameBranding name for packages (branding-<name>-*). Requires build-type.
subpackagesSubpackages of branding to be installed (branding-<name>-<subpackage>). If empty, all will be installed. Requires name.
release-overridesA dictionary for overriding or adding fields in os-release.
build-typeThe build type, required for os-release. Requires name.

Supported build types:

  • stable
  • nightly
Example

ALT Atomic Core:

  - name: Set branding
    type: branding
    body:
      name: alt-atomic-${{ Env.IMAGE_NAME }}
      build-type: ${{ Env.IMAGE_TYPE }}

Copying (copy)

The copy module is designed for copying files and directories.

Legend

! — required field

FieldDescription
source!Path to the file to copy.
destination!Path to the file to copy to.
replaceWhether to replace destination.
Example

ALT Atomic Core:

  - name: Copy root
    type: copy
    body:
      source: root
      destination: /
      replace: true

Git (git)

The git module is designed to work with Git repositories: installing dependencies, building, installing the results of the work in the system, and so on.

Legend

! — required field

FieldDescription
url!URL of the git repository.
command!Commands to execute relative to the git repository.
build-depsDependencies for the build. They will be removed after the module is completed.
depsDependencies for the program itself. They will not be removed after the module is completed, even if specified in build-deps.
revGit revision.
quietHides command output.

Including other configs (include)

The include module is intended for including other configurations.

Legend

! — required field

FieldDescription
targets!YAML configs for execution
Example

ALT Atomic Core:

  - name: Cleanup
    type: include
    body:
      targets:
        - cleanup.yml

Working with the kernel (kernel)

The kernel module is designed to select the kernel version (flavour), connect additional modules, include headers, and rebuild initramfs.

FieldDescription
kernel-infoWorking with the kernel and kernel modules
initrdWorking with initrd

The kernel-info subsection

FieldDescription
flavorKernel version
modulesNames of the kernel modules (kernel-module-<name>-<flavor>)
include-headersWhether to include core headers

The initrd subsection

FieldDescription
rebuild-initrd-methodSupported: dracut, auto. If empty and one of flavour, modules, include-headers is specified, then auto is used
plymouth-themePlymouth boot screen theme (plymouth-theme-<name>)
Example

ALT Atomic Core:

  - name: Update kernel
    type: kernel
    body:
      kernel-info:
        flavour: ${{ Env.KERNEL_FLAVOUR }}
        modules:
          - drm
      initrd:
        method: dracut

The link module is designed to create symbolic links to objects.

Legend

! — required field

FieldDescription
target!Where to create the link, absolute path
to!Where it will lead
replaceWhether to replace target
Example

ALT Atomic Core

  - type: link
    body:
      target: /ostree
      to: /sysroot/ostree
      replace: true

Merging file contents (merge)

The merge module is designed to merge files.

Legend

! — required field

FieldDescription
source!Path to the file whose contents need to be taken
destination!Path to the file where the contents need to be added
create-file-permPermissions for creating a file in the rwxrwxrwx format if it doesn’t exist
prependShould the content be added to the beginning of the file?

Creating directories (mkdir)

The mkdir module is designed to create directories at the specified paths with defined ownership rights.

Legend

! — required field

FieldDescription
targets!Paths where directories need to be created
perm!Permissions for directories in the format rwxrwxrwx
Example

ALT Atomic Core:

  - type: mkdir
    body:
      targets:
        - /sysroot
      perm: rwxr-xr-x

Moving objects (move)

The move module is designed to move objects in the file system, with the option to leave a reference in place of the moved object.

Legend

! — required field

FieldDescription
source!What
destination!Where
replaceReplace the object at destination
create-linkCreate a link from the target’s parent directory to the destination
Example

ALT Atomic Core:

  - type: move
    body:
      source: /etc/apt
      destination: /usr/share/apt
      create-link: true

Network configuration (network)

The network module is designed to configure network settings.

Legend

! — required field

FieldDescription
hostname!Device network name
Example

ALT Atomic Core:

  - type: network
    body:
      hostname: alt-atomic-${{ Env.IMAGE_NAME }}

Working with packages (packages)

The packages module is designed to work with packages: installation, removal, updating the database and the packages themselves.

FieldDescription
installPackages to be installed
removePackages to be removed
updateWhether to update the database before the transaction
upgradeWhether to update the packages before the transaction
dependsRemove packages with dependencies
Example

ALT Atomic Core:

  - type: packages
    body:
      install:
        - glxinfo
        - mesa-dri-drivers
      update: true
      upgrade: true

Removing objects (remove)

The remove module is designed to delete objects.

Legend

! — required field

FieldDescription
targets!Path to the objects that need to be deleted
insideClear objects instead of deleting
Example

ALT Atomic Core:

  - name: Clean logs
    type: remove
    body:
      targets:
        - /var/log/README.logs
        - /var/log/rpmpkgs
      inside: true

Changing the file content (replace)

The replace module is designed to replace the contents of a file based on a regular expression.

Legend

! — required field

FieldDescription
target!Path to the file
pattern!Regular expression pattern
repl!Replacement

Working with repositories (repos)

The repos module is designed to clean, install custom or pre-installed repositories, and add tasks (projects).

Legend

! — required field

FieldDescription
cleanClear all repositories. Conflicts with clean-temporary
customCustom entries in sources.list
branchALT repository branch. Comments out the remaining repositories; to clean up, use clean
dateDate in the format YYYYMMDD or YYYY/MM/DD. If empty, the current (non-archived) repository is used. Requires branch
tasksTasks to be included as repositories
no-updateDo not update the database after saving the repositories
clean-temporaryClear temporary repositories. Conflicts with clean

List of available branches:

  • sisyphus
Example

ALT Atomic Core:

  - name: Set repos
    type: repos
    body:
      branch: sisyphus
      date: ${{ Env.YEAR }}/${{ Env.MONTH }}/${{ Env.DAY }}
      clean: true

Executing scripts (shell)

The shell module is designed to execute imperative code in Bash.

Legend

! — required field

FieldDescription
command!Commands to execute
quietHides command output
Example

ALT Atomic Core:

  - name: Set root password
    type: shell
    body:
      command: echo "root:root" | chpasswd

Working with SystemD services (systemd)

The systemd module is designed to monitor the status of SystemD.

Legend

! — required field

FieldDescription
targetsService names
enabledWhether to enable the service or not. Conflicts with masked
globalWhether to enable the service globally, for all users
maskedWhether to mask the service. Conflicts with enabled
Example

ALT Atomic Core:

  - type: systemd
    body:
      targets:
        - ostree-remount
        - NetworkManager
        - libvirtd
        - chrony
        - podman.socket
        - sync-users.service
        - sync-directory.service
        - tmp.mount
      enabled: true

Released under the GPL-3.0+ license. Content is available under the CC BY-SA 4.0 license, unless otherwise stated.