Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hack/os-image-map.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"base": {
"rhel-10.2": "images.paas.redhat.com/bootc/rhel-bootc:latest-10.2",
"rhel-9.8": "images.paas.redhat.com/bootc/rhel-bootc:latest-9.8",
"centos-9": "quay.io/centos-bootc/centos-bootc:stream9",
"centos-10": "quay.io/centos-bootc/centos-bootc:stream10",
"fedora-42": "quay.io/fedora/fedora-bootc:42",
Expand Down
21 changes: 20 additions & 1 deletion tmt/tests/booted/test-soft-reboot-selinux-policy.nu
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,30 @@ def initial_build [] {

bootc image copy-to-storage

# copy-to-storage does not copy repo file
# but OSCI gating test needs repo to install package
let os = open /usr/lib/os-release
| lines
| filter {|l| $l != "" and not ($l | str starts-with "#") }
| parse "{key}={value}"
| reduce {|it, acc|
$acc | upsert $it.key ($it.value | str trim -c '"')
}
Comment on lines +37 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The manual parsing of /usr/lib/os-release can be simplified. Nushell's from dotenv command can parse this file format directly, making the code more concise and readable.

    let os = open /usr/lib/os-release | from dotenv

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nushell's from dotenv command

This one looks like a hallucination

Copy link
Collaborator Author

@henrywang henrywang Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, there's no dotenv in my side.

Usage:
  > from

Subcommands:
  from csv - Parse text as .csv and create table.
  from json - Convert from json to structured data.
  from msgpack - Convert MessagePack data into Nu values.
  from msgpackz - Convert brotli-compressed MessagePack data into Nu values.
  from nuon - Convert from nuon to structured data.
  from ods - Parse OpenDocument Spreadsheet(.ods) data and create table.
  from ssv - Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2.
  from toml - Parse text as .toml and create record.
  from tsv - Parse text as .tsv and create table.
  from url - Parse url-encoded string as a record.
  from xlsx - Parse binary Excel(.xlsx) data and create table.
  from xml - Parse text as .xml and create record.
  from yaml - Parse text as .yaml/.yml and create table.
  from yml - Parse text as .yaml/.yml and create table.

Flags:
  -h, --help: Display the help message for this command

mut repo_copy = ""

if $os.ID == "rhel" {
cp /etc/yum.repos.d/rhel.repo .
$repo_copy = "COPY rhel.repo /etc/yum.repos.d/"
Comment on lines +47 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The filename rhel.repo appears to be incorrect. On standard RHEL systems, the main repository file is typically named redhat.repo. Using rhel.repo would likely cause the cp command to fail and break the test on a standard RHEL environment.

If rhel.repo is intentionally used and is specific to the OSCI environment, it would be helpful to add a comment explaining this context.

For better robustness and portability, you might consider copying all .repo files instead of relying on a single hardcoded name. This would make the test less brittle to changes in repository configuration. For example:

if $os.ID == "rhel" {
    cp (glob /etc/yum.repos.d/*.repo) .
    $repo_copy = "COPY *.repo /etc/yum.repos.d/"
}
        cp /etc/yum.repos.d/redhat.repo .
        $repo_copy = "COPY redhat.repo /etc/yum.repos.d/"

}

# Create a derived container that installs a custom SELinux policy module
# Installing a policy module will change the compiled policy checksum
# Following Colin's suggestion and the composefs-rs example
# We create a minimal policy module and install it
"FROM localhost/bootc
$"
FROM localhost/bootc
($repo_copy)

# Install tools needed to build and install SELinux policy modules
RUN dnf install -y selinux-policy-devel checkpolicy policycoreutils

Expand Down