Image build

Image build within local builder is not available with Community edition.

See Community edition chapter for more information.

The combination of rp-cli and the local builder allows the user to build custom redpesk images. In order to build an image locally, the user first needs to create a parent project. Inside this project an image object can be created, thanks to the rp-cli images add command.

Creating a new project

# Creation of the parent project, supporting image type
$ rp-cli projects add -n "Custom Image project" -a "custom-image-project" --mandatory-distro redpesk-lts-batz-2.0-update --mandatory-arch x86_64 --optional-arch aarch64 --images
-- Project creation requested by user --
Checking that at least one architecture is set...	[OK]
Checking that at least one distribution is set...	[OK]
Creation of "Custom Image project" project...	[OK]

Creating a new image

Once that a parent project has been created, you can proceed with the image creation thanks to the rp-cli images add command. Use --help to explore available options and sub-commands of rp-cli images add.

rp-cli images add --help

Here is an example to create a x86_64 redpesk-os image:

rp-cli images add -n "My beautiful image" --arch x86_64 -d redpesk-lts-batz-2.0-update --security smack -p custom-image-project \
    --ks-url "" \
    --ks-branch "batz-2.0-update" \
    --ks-path "." \
    --ks-file "Redpesk-minimal-x86_64-smack.ks"

WARNING: Note that all repo must respect the configured image architecture otherwise, image will not build.

Building an image

Once the image object added inside the redpesk backend, rp-cli is ready to launch the build of the image. To have more information, you can consult help:

rp-cli images localbuild --help

Let’s see with our example:

rp-cli images localbuild my-beautiful-image

The build is now launched, just wait for the build to be completed.

-- Local build of an image requested by user --

Checking that all needed parameters are set...			    [OK]
Checking and preparing the directory for image build...	[OK]

"Image build" directory set-up: /home/devel/sandbox/gitpkgs/image_localbuild_my-beautiful-image

kickstart = Redpesk-core-x86_64-smack.ks
Will try to checkout to batz-2.0-update (commit_checkout)
Commit checkout batz-2.0-update is set as a RefType.BRANCH ref
Trying shallow clone source from into /tmp/tmp1ega1jyl/gitsource
Successfull shallow cloned.
Preparing the kickstart
Writing kickstart in temporary dir /tmp/tmp1ega1jyl/Redpesk-core-x86_64-smack.ks
Writing TDL in temporary dir /tmp/tmp1ega1jyl/tdl-x86_64.xml
Building image
DEBUG:oz.Guest.RedPeskGuest:libvirt bridge name is virbr0
DEBUG:oz.Guest.RedPeskGuest:Libvirt type is kvm
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1):


DEBUG:oz.ozutil:Waiting for my-beautiful-image to finish installing, 99630/100000
DEBUG:oz.ozutil:Waiting for my-beautiful-image to finish shutdown, 90/90
INFO:oz.Guest.RedPeskGuest:Install of my-beautiful-image succeeded
INFO:oz.Guest.RedPeskGuest:Generate XML for guest my-beautiful-image with bootdev hd
DEBUG:oz.Guest.RedPeskGuest:Generated XML:
<domain type="kvm">
  <clock offset="utc"/>
    <type machine="q35">hvm</type>
    <boot dev="hd"/>
    <loader readonly="yes" type="pflash">/usr/share/OVMF/OVMF_CODE.secboot.fd</loader>
    <nvram template="/usr/share/OVMF/OVMF_VARS.secboot.fd"/>
    <graphics port="-1" type="vnc"/>
    <interface type="bridge">
      <source bridge="virbr0"/>
      <mac address="52:54:00:87:55:ef"/>
      <model type="virtio"/>
    <input bus="ps2" type="mouse"/>
    <serial type="pty">
      <target port="0"/>
    <serial type="tcp">
      <source mode="bind" host="" service="50791"/>
      <protocol type="raw"/>
      <target port="1"/>
    <rng model="virtio">
      <rate bytes="1024" period="1000"/>
      <backend model="random">/dev/random</backend>
    <disk device="disk" type="file">
      <target dev="vda" bus="virtio"/>
      <source file="/home/devel/.oz/images/my-beautiful-image.dsk"/>
      <driver name="qemu" type="raw"/>

INFO:oz.Guest.RedPeskGuest:Cleaning up after install
Libvirt XML was written to my-beautiful-imageAug_23_2021-15:25:37
Compressing image
Removing the image and workdir.

Congratulations! Your image build seems to be successful!
Image available in: /home/devel/sandbox/gitpkgs/image_localbuild_my-beautiful-image