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
34 changes: 22 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Full CI: build DKMS modules, run smoke tests on every PR.
# On workflow_dispatch, also run ptp-operator e2e tests — build images
# once (ptp-images), then run each scenario in parallel (ptp-test matrix).
# Full CI: build DKMS modules, run smoke tests, build ptp-operator images,
# and run ptp-operator e2e tests on every PR and workflow_dispatch.

name: CI

on:
pull_request:
workflow_dispatch:

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
DKMS_PKG: netdevsim
DKMS_VER: "6.9.5"
PTP_REPO: https://github.com/edcdavid/ptp-operator-upstream.git
PTP_BRANCH: netdevsim-dkms
PTP_REPO: https://github.com/k8snetworkplumbingwg/ptp-operator.git
PTP_BRANCH: main

jobs:
# ------------------------------------------------------------------
Expand Down Expand Up @@ -100,9 +103,17 @@ jobs:
set -euo pipefail
ls /sys/class/nsim_ptp/
ls -la /dev/nsim_ptp* /dev/ptp* 2>/dev/null || echo "No PTP devices found"
readlink /dev/ptp0 2>/dev/null | grep -q nsim_ptp \
&& echo "OK: /dev/ptp0 -> $(readlink /dev/ptp0)" \
|| echo "WARN: /dev/ptp0 symlink not found"
if [ -e /dev/ptp0 ] && [ -e /dev/nsim_ptp0 ]; then
PTP_RDEV=$(stat -c '%t:%T' /dev/ptp0)
NSIM_RDEV=$(stat -c '%t:%T' /dev/nsim_ptp0)
if [ "$PTP_RDEV" = "$NSIM_RDEV" ]; then
echo "OK: /dev/ptp0 ($PTP_RDEV) matches /dev/nsim_ptp0"
else
echo "WARN: /dev/ptp0 ($PTP_RDEV) != /dev/nsim_ptp0 ($NSIM_RDEV)"
fi
else
echo "WARN: /dev/ptp0 or /dev/nsim_ptp0 not found"
fi

- name: Smoke test — verify ethtool PHC
if: steps.load.outputs.load_ok == 'true'
Expand Down Expand Up @@ -133,10 +144,8 @@ jobs:

# ------------------------------------------------------------------
# ptp-operator: build images once and upload as artifact
# (workflow_dispatch only)
# ------------------------------------------------------------------
ptp-images:
if: github.event_name == 'workflow_dispatch'
needs: dkms-test
runs-on: ubuntu-22.04
timeout-minutes: 45
Expand Down Expand Up @@ -174,6 +183,9 @@ jobs:
set -x
export PATH=/usr/local/go/bin:/root/go/bin:$PATH
export KIND_EXPERIMENTAL_PROVIDER=podman
export BUILDAH_LAYERS=true
export BUILDAH_HISTORY=true
export PODMAN_BUILD_OPTS="--rm=false --force-rm=false"

VM_IP=$(hostname -I | awk '{print $1}')
cd /root/ptp-operator/scripts
Expand All @@ -189,10 +201,8 @@ jobs:

# ------------------------------------------------------------------
# ptp-operator: one parallel runner per scenario
# (workflow_dispatch only)
# ------------------------------------------------------------------
ptp-test:
if: github.event_name == 'workflow_dispatch'
needs: ptp-images
runs-on: ${{ matrix.os }}
timeout-minutes: 90
Expand Down
11 changes: 9 additions & 2 deletions 99-nsim-ptp.rules
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Create /dev/ptp* compat symlinks for nsim_ptp devices so that
# Create /dev/ptpN compat device nodes for nsim_ptp devices so that
# linuxptp tools (ptp4l, phc2sys, ts2phc) find clocks at the
# standard path reported by ethtool -T.
#
# The nsim_ptp module registers a separate device class to avoid
# colliding with the kernel's built-in PTP subsystem, but ethtool
# still reports integer PHC indices that userspace maps to /dev/ptpN.
#
# We use RUN+=mknod instead of SYMLINK+= because real device nodes
# propagate into containers (Kind nodes, Kubernetes pods), whereas
# udev symlinks only exist on the host devtmpfs.
#
# MODE="0666" is needed because the non-standard major number (234)
# is not in the default cgroup device allowlist; containers and
# systemd-sandboxed services (DevicePolicy=closed) would get
# "Operation not permitted" without world-readable permissions.
SUBSYSTEM=="nsim_ptp", KERNEL=="nsim_ptp[0-9]*", MODE="0666", SYMLINK+="ptp%n"
SUBSYSTEM=="nsim_ptp", KERNEL=="nsim_ptp[0-9]*", MODE="0666", \
RUN+="/bin/sh -c 'rm -f /dev/ptp%n; mknod /dev/ptp%n c %M %m; chmod 666 /dev/ptp%n'"
SUBSYSTEM=="nsim_ptp", KERNEL=="nsim_ptp[0-9]*", ACTION=="remove", \
RUN+="/bin/rm -f /dev/ptp%n"
Loading
Loading