Build the RPM package for the application manifests

To build your own RPMs, you must create a spec file that adds the application manifests to the RPM package. If the application RPMs and other elements needed for image building are accessible to image builder, you can use the method that you prefer.

The following is an example procedure.

Prerequisites
  • You have set up a Red Hat Enterprise Linux for Edge (RHEL for Edge) 9.6 build host that meets the image builder system requirements.

  • You have root access to the host.

  • The file tree required to build RPM packages was created.

Procedure
  1. In the ~/rpmbuild/SPECS directory, create a file such as <application_workload_manifests.spec> using the following template:

    Example spec file
    Name: <application_workload_manifests>
    Version: 0.0.1
    Release: 1%{?dist}
    Summary: Adds workload manifests to microshift
    BuildArch: noarch
    License: GPL
    Source0: %{name}-%{version}.tar.gz
    #Requires: microshift
    %description
    Adds workload manifests to microshift
    %prep
    %autosetup
    %install
    rm -rf $RPM_BUILD_ROOT
    mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/microshift/manifests
    cp -pr ~/manifests $RPM_BUILD_ROOT/%{_prefix}/lib/microshift/
    %clean
    rm -rf $RPM_BUILD_ROOT
    
    %files
    %{_prefix}/lib/microshift/manifests/**
    %changelog
    * _<DDD MM DD YYYY username@domain - V major.minor.patch>
    - <your_change_log_comment>

    The %install section creates the target directory inside the RPM package, /usr/lib/microshift/manifests/ and copies the manifests from the source home directory, ~/manifests.

    Important

    All of the required YAML files must be in the source home directory ~/manifests, including a kustomize.yaml file if you are using kustomize.

  2. Build your RPM package in the ~/rpmbuild/RPMS directory by running the following command:

    $ rpmbuild -bb ~/rpmbuild/SPECS/<application_workload_manifests.spec>