Skip to content

Latest commit

 

History

History
124 lines (98 loc) · 4.46 KB

development-rhcos.md

File metadata and controls

124 lines (98 loc) · 4.46 KB

Building and developing Red Hat Enterprise Linux CoreOS

Background

RHEL CoreOS (RHCOS) is a derivative of Red Hat Enterprise Linux (RHEL), CentOS Strema CoreOS (SCOS) and Fedora CoreOS (FCOS). The tool to build RHCOS, SCOS and FCOS is coreos-assembler. The process detailled here is thus very similar to the one described in Building Fedora CoreOS or Building and developing CentOS Stream CoreOS but requires access to Red Hat internal resources.

Build process

Note that this documentation applies only to RHCOS versions starting with 4.9 and later. For older versions, see the internal documentation.

  • Make sure you're meeting the prerequisites.

  • Make sure that you have setup the Red Hat internal CA on your system and that you are connected to the Red Hat VPN.

  • Setup a cosa alias, following the upstream documentation.

    • Note: If you encounter DNS resolution issues with COSA when on the Red Hat VPN, you should try adding --net=host to the podman invocation.
  • Always make sure that you are using the latest build of the specific version of the COSA container matching with the version of RHCOS that you want to build:

    # Use the latest version for the main developement branch:
    # The export command below is optional here as it is the default
    $ export COREOS_ASSEMBLER_CONTAINER=quay.io/coreos-assembler/coreos-assembler:latest
    $ podman pull quay.io/coreos-assembler/coreos-assembler
    
    # For branched releases:
    $ export COREOS_ASSEMBLER_CONTAINER=quay.io/coreos-assembler/coreos-assembler:rhcos-4.10
    $ podman pull quay.io/coreos-assembler/coreos-assembler:rhcos-4.10
    
  • Create and use a dedicated directory:

    $ mkdir rhcos
    $ cd rhcos
    

    If you're going to work on multiple versions of RHCOS, using a dedicated directory for each version is recommended:

    $ mkdir rhcos-4.11
    $ cd rhcos-4.11
    
  • Make sure that you have setup the latest internal Red Hat root certificates on your host system. See the internal documentation.

  • Make sure that you have the latest cosa alias from the documentation. Then ask COSA to use those certificates:

    $ export COREOS_ASSEMBLER_ADD_CERTS='y'
    
  • Get the following value from the internal documentation:

    $ export RHCOS_REPO="..."
    
  • Clone the config repo (openshift/os), passing as argument the internal Git repo which includes the RPM repo configs and optionaly the specific branch:

    # Main developement branch, default version
    $ cosa init --yumrepos "${RHCOS_REPO}" https://github.com/openshift/os.git
    
    # Main developement branch, selecting a specific variant
    $ cosa init --yumrepos "${RHCOS_REPO}" --variant rhel-9.2 https://github.com/openshift/os.git
    
    # Specific release branch, selecting a specific variant
    $ cosa init --yumrepos "${RHCOS_REPO}" --variant rhel-9.2 --branch release-4.13 https://github.com/openshift/os.git
    
  • Fetch packages and build RHCOS ostree container and QEMU image:

    $ cosa fetch
    $ cosa build
    

Building RHCOS images for other platforms than QEMU

  • You can build images for platforms that are supported in COSA using the buildextend commands:
    $ cosa buildextend-aws
    $ cosa buildextend-openstack
    

Running RHCOS locally for testing

  • You may then run an ephemeral virtual machine using QEMU with:
    $ cosa run
    

Testing RHCOS with kola

  • You may then run tests on the image built with kola:
    # Run basic QEMU scenarios
    $ cosa kola run basic*
    # Run all kola tests (internal & external)
    $ cosa kola run --parallel 2
    

Overriding packages for testing

  • If you need to override a file or a package for local testing, you can place those into the override/rootfs or override/rpm directory before building the image. See the Using overrides section from the COSA documentation.