|
| 1 | +name: RHEL 10 Docker/Podman/SELinux Compatibility |
| 2 | + |
| 3 | +# Exercises the Docker and Podman compute drivers on a bare RHEL 10 runner |
| 4 | +# with SELinux enforcing. This is the cross-compatibility check requested in |
| 5 | +# https://github.com/NVIDIA/OpenShell/pull/2092: RHEL ships Podman but not |
| 6 | +# Docker, so this job installs Docker Engine alongside the preinstalled |
| 7 | +# Podman, confirms both engines coexist on one host, and runs the standard |
| 8 | +# Docker/Podman e2e suites against a real SELinux-enforcing kernel (unlike |
| 9 | +# the Ubuntu-based `ghcr.io/nvidia/openshell/ci` image used by e2e-test.yml, |
| 10 | +# which does not enforce SELinux). This gives bind-mount relabeling changes |
| 11 | +# (e.g. the `selinux_label`/`:z`/`:Z` support added in #2092) a host that can |
| 12 | +# actually deny mislabeled mounts. |
| 13 | +# |
| 14 | +# Runs on a bare runner (no `container:` image) because installing/configuring |
| 15 | +# dockerd and reading SELinux/audit state requires direct access to the host, |
| 16 | +# which a containerized step cannot provide. |
| 17 | +# |
| 18 | +# Requires a GitHub-hosted "larger runner" provisioned with the RHEL 10 |
| 19 | +# partner image under this repo's runner label (see |
| 20 | +# https://github.blog/changelog/2026-06-25-red-hat-enterprise-linux-runner-images-are-now-in-public-preview/). |
| 21 | +# That provisioning happens in GitHub org settings, not in this repo; until an |
| 22 | +# org admin creates a runner with the `linux-amd64-rhel10` label, jobs using |
| 23 | +# the default `runner` input will queue indefinitely. |
| 24 | + |
| 25 | +on: |
| 26 | + workflow_call: |
| 27 | + inputs: |
| 28 | + image-tag: |
| 29 | + description: "Image tag to test (typically the commit SHA)" |
| 30 | + required: true |
| 31 | + type: string |
| 32 | + runner: |
| 33 | + description: "GitHub Actions runner label (must be a RHEL 10 image)" |
| 34 | + required: false |
| 35 | + type: string |
| 36 | + default: "linux-amd64-rhel10" |
| 37 | + checkout-ref: |
| 38 | + description: "Git ref to check out for test inputs (defaults to the workflow SHA)" |
| 39 | + required: false |
| 40 | + type: string |
| 41 | + default: "" |
| 42 | + mise-version: |
| 43 | + description: "mise version to install on the bare RHEL runner" |
| 44 | + required: false |
| 45 | + type: string |
| 46 | + default: "v2026.4.25" |
| 47 | + |
| 48 | +permissions: |
| 49 | + contents: read |
| 50 | + packages: read |
| 51 | + |
| 52 | +jobs: |
| 53 | + rhel-selinux-compat: |
| 54 | + name: RHEL 10 Docker + Podman + SELinux |
| 55 | + runs-on: ${{ inputs.runner }} |
| 56 | + timeout-minutes: 45 |
| 57 | + permissions: |
| 58 | + contents: read |
| 59 | + packages: read |
| 60 | + env: |
| 61 | + MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + MISE_VERSION: ${{ inputs.mise-version }} |
| 63 | + IMAGE_TAG: ${{ inputs.image-tag }} |
| 64 | + OPENSHELL_SUPERVISOR_IMAGE: ${{ format('ghcr.io/nvidia/openshell/supervisor:{0}', inputs.image-tag) }} |
| 65 | + OPENSHELL_REGISTRY: ghcr.io/nvidia/openshell |
| 66 | + OPENSHELL_REGISTRY_HOST: ghcr.io |
| 67 | + OPENSHELL_REGISTRY_NAMESPACE: nvidia/openshell |
| 68 | + OPENSHELL_REGISTRY_USERNAME: ${{ github.actor }} |
| 69 | + OPENSHELL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 72 | + with: |
| 73 | + ref: ${{ inputs['checkout-ref'] || github.sha }} |
| 74 | + |
| 75 | + - name: Record host facts |
| 76 | + run: | |
| 77 | + set -euo pipefail |
| 78 | + cat /etc/os-release |
| 79 | + uname -a |
| 80 | + getenforce || echo "getenforce not available" |
| 81 | +
|
| 82 | + - name: Require SELinux enforcing |
| 83 | + run: | |
| 84 | + set -euo pipefail |
| 85 | + mode="$(getenforce)" |
| 86 | + echo "SELinux mode: ${mode}" |
| 87 | + if [ "${mode}" != "Enforcing" ]; then |
| 88 | + echo "::error::SELinux must be Enforcing on this runner for the compatibility check to be meaningful (got: ${mode})" |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | +
|
| 92 | + - name: Record job start time for audit search |
| 93 | + id: audit_window |
| 94 | + run: echo "start=$(date -u '+%m/%d/%Y %H:%M:%S')" >> "$GITHUB_OUTPUT" |
| 95 | + |
| 96 | + - name: Install build and test dependencies |
| 97 | + run: | |
| 98 | + set -euo pipefail |
| 99 | + sudo dnf install -y \ |
| 100 | + ca-certificates \ |
| 101 | + curl \ |
| 102 | + git \ |
| 103 | + gcc \ |
| 104 | + gcc-c++ \ |
| 105 | + make \ |
| 106 | + clang \ |
| 107 | + clang-devel \ |
| 108 | + z3-devel \ |
| 109 | + pkgconf-pkg-config \ |
| 110 | + openssl-devel \ |
| 111 | + openssh-clients \ |
| 112 | + python3 \ |
| 113 | + cmake \ |
| 114 | + socat \ |
| 115 | + unzip \ |
| 116 | + xz \ |
| 117 | + jq \ |
| 118 | + rsync \ |
| 119 | + zstd \ |
| 120 | + audit \ |
| 121 | + policycoreutils |
| 122 | +
|
| 123 | + - name: Install Docker Engine |
| 124 | + # RHEL doesn't ship Docker; install it alongside the preinstalled |
| 125 | + # Podman, per https://github.com/NVIDIA/OpenShell/pull/2092#issuecomment-4856873804. |
| 126 | + run: | |
| 127 | + set -euo pipefail |
| 128 | + curl -fsSL https://get.docker.com | sudo bash |
| 129 | + sudo sed -i "s#/usr/bin/dockerd#/usr/bin/dockerd --ip-forward-no-drop#g" /usr/lib/systemd/system/docker.service |
| 130 | + sudo systemctl daemon-reload |
| 131 | + sudo systemctl enable --now docker |
| 132 | +
|
| 133 | + - name: Grant runner user access to the Docker socket |
| 134 | + run: | |
| 135 | + set -euo pipefail |
| 136 | + sudo groupadd -f docker |
| 137 | + sudo usermod -aG docker "$(id -un)" |
| 138 | + sudo chmod 666 /var/run/docker.sock |
| 139 | +
|
| 140 | + - name: Verify Podman is available |
| 141 | + run: | |
| 142 | + set -euo pipefail |
| 143 | + if ! command -v podman >/dev/null 2>&1; then |
| 144 | + echo "podman not preinstalled; installing via dnf" |
| 145 | + sudo dnf install -y podman |
| 146 | + fi |
| 147 | + podman --version |
| 148 | +
|
| 149 | + - name: Verify Docker and Podman coexist |
| 150 | + run: | |
| 151 | + set -euo pipefail |
| 152 | + docker version |
| 153 | + docker info |
| 154 | + podman version |
| 155 | + podman info |
| 156 | +
|
| 157 | + - name: Install mise |
| 158 | + run: | |
| 159 | + curl https://mise.run | MISE_VERSION="${MISE_VERSION}" sh |
| 160 | + echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
| 161 | + echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH" |
| 162 | +
|
| 163 | + - name: Install tools |
| 164 | + run: mise install --locked |
| 165 | + |
| 166 | + - name: Log in to GHCR with Docker |
| 167 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin |
| 168 | + |
| 169 | + - name: Log in to GHCR with Podman |
| 170 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u "${{ github.actor }}" --password-stdin |
| 171 | + |
| 172 | + - name: Run Docker-backed e2e suite |
| 173 | + run: mise run --no-deps --skip-deps e2e:docker |
| 174 | + |
| 175 | + - name: Run Podman-backed e2e suite |
| 176 | + run: mise run --no-deps --skip-deps e2e:podman |
| 177 | + |
| 178 | + - name: Check for unexpected SELinux denials |
| 179 | + run: | |
| 180 | + set -euo pipefail |
| 181 | + echo "Searching audit log for AVC denials since ${AUDIT_WINDOW_START}" |
| 182 | + if sudo ausearch -m avc,user_avc -ts "${AUDIT_WINDOW_START}" 2>/dev/null | tee /tmp/avc-denials.log | grep -q .; then |
| 183 | + echo "::error::SELinux denied one or more operations during the e2e suites; see the log below" |
| 184 | + cat /tmp/avc-denials.log |
| 185 | + exit 1 |
| 186 | + fi |
| 187 | + echo "No SELinux denials recorded." |
| 188 | + env: |
| 189 | + AUDIT_WINDOW_START: ${{ steps.audit_window.outputs.start }} |
| 190 | + |
| 191 | + - name: Collect SELinux/audit context on failure |
| 192 | + if: failure() |
| 193 | + run: | |
| 194 | + set +e |
| 195 | + echo "=== getenforce ===" |
| 196 | + getenforce |
| 197 | + echo "=== recent AVC denials ===" |
| 198 | + sudo ausearch -m avc,user_avc -ts "${AUDIT_WINDOW_START}" 2>/dev/null |
| 199 | + echo "=== dockerd status ===" |
| 200 | + sudo systemctl status docker --no-pager |
| 201 | + echo "=== recent kernel log ===" |
| 202 | + sudo journalctl -k --no-pager | tail -n 200 |
| 203 | + exit 0 |
| 204 | + env: |
| 205 | + AUDIT_WINDOW_START: ${{ steps.audit_window.outputs.start }} |
0 commit comments