Skip to content

Commit 4433619

Browse files
martin-matclaude
andauthored
ci: run the CNTi essential tests nightly and show the result as a badge (#669)
Signed-off-by: Martin Matyas <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 758ad14 commit 4433619

4 files changed

Lines changed: 113 additions & 0 deletions

File tree

‎.github/cnti/cnti-testsuite.yaml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# CNTi Test Suite configuration for the essential tests run by
2+
# .github/workflows/cnti.yml. The chart is installed with its defaults; no
3+
# image tags are configured for the rolling update, downgrade and rollback
4+
# tests, which are not essential tests: the suite skips them without one,
5+
# and from its next release takes the image's previous release itself.
6+
---
7+
config_version: "v2"
8+
deployments:
9+
helm_dirs:
10+
- name: eupf
11+
helm_directory: ../../.deploy/helm/eupf
12+
namespace: eupf

‎.github/cnti/kind.yaml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# kind cluster for the CNTi essential tests: a control plane and two workers,
2+
# so node_drain has somewhere to move eUPF. As the chart README asks, every
3+
# kubelet allows the unsafe sysctl net.ipv4.ip_forward the chart sets (or the
4+
# pod is rejected at admission), and every node has the host's BPF filesystem
5+
# at /sys/fs/bpf: eUPF runs as a non-root user and pins its maps there, which
6+
# systemd hosts mount and kind nodes don't.
7+
kind: Cluster
8+
apiVersion: kind.x-k8s.io/v1alpha4
9+
nodes:
10+
- role: control-plane
11+
kubeadmConfigPatches: &allow-ip-forward
12+
- |
13+
kind: KubeletConfiguration
14+
allowedUnsafeSysctls:
15+
- "net.ipv4.ip_forward"
16+
extraMounts: &bpffs
17+
- hostPath: /sys/fs/bpf
18+
containerPath: /sys/fs/bpf
19+
- role: worker
20+
kubeadmConfigPatches: *allow-ip-forward
21+
extraMounts: *bpffs
22+
- role: worker
23+
kubeadmConfigPatches: *allow-ip-forward
24+
extraMounts: *bpffs

‎.github/workflows/cnti.yml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Installs the eUPF chart with its defaults on a kind cluster every night,
2+
# runs the CNTi Test Suite's essential tests against it and publishes the
3+
# result as the badge in the README. https://github.com/lfn-cnti/testsuite-action
4+
#
5+
# For problems with the action or the test suite, open an issue at
6+
# https://github.com/lfn-cnti/testsuite-action/issues
7+
name: CNTi essential
8+
9+
on:
10+
schedule:
11+
# Off the full hour: GitHub delays or drops scheduled runs under load,
12+
# which peaks at the start of each hour.
13+
- cron: "37 3 * * *"
14+
# By hand, and on pull requests that change the job, its configuration or
15+
# the chart.
16+
workflow_dispatch:
17+
pull_request:
18+
paths:
19+
- .github/workflows/cnti.yml
20+
- .github/cnti/**
21+
- .deploy/helm/eupf/**
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
# The nightly run and manual runs on main: the only runs that publish the
28+
# badge, and the only ones with a write token. Forks that enable scheduled
29+
# workflows do not run either job.
30+
essential:
31+
if: github.repository == 'edgecomllc/eupf' && github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 60
34+
permissions:
35+
# Publishes the badge to the orphan branch `badges`.
36+
contents: write
37+
steps: &essential-steps
38+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
39+
with:
40+
# The suite doesn't need the job's write token; the action passes it
41+
# to the badge publisher on its own.
42+
persist-credentials: false
43+
44+
- uses: lfn-cnti/testsuite-action@70536fda55fcb11f4f7463175fe9d57c86b85574 # v1.2.0
45+
with:
46+
# A released suite version, bumped on purpose after reading the
47+
# release notes.
48+
version: v2.3.0
49+
cnf_config: .github/cnti/cnti-testsuite.yaml
50+
kind_config: .github/cnti/kind.yaml
51+
tests: cert
52+
badge_branch: badges
53+
54+
# Why did eUPF not come up? Pod state, events and logs from the kind
55+
# cluster the action created; it lives until the job ends.
56+
- name: Diagnostics
57+
if: failure()
58+
run: |
59+
set +e
60+
kubectl get pods -A -o wide
61+
kubectl describe pods -n eupf | tail -80
62+
kubectl logs -n eupf --all-containers --tail=60 -l app.kubernetes.io/name=eupf
63+
kubectl get events -n eupf --sort-by=.lastTimestamp | tail -40
64+
65+
# Pull requests that change the job or its configuration, and manual runs on
66+
# other branches: the same steps with a read-only token. The action publishes
67+
# the badge only from the default branch, so nothing is published here.
68+
essential-pr:
69+
if: github.repository == 'edgecomllc/eupf' && (github.event_name == 'pull_request' || github.ref != 'refs/heads/main')
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 60
72+
permissions:
73+
contents: read
74+
steps: *essential-steps

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Build][build-img]][build]
77
[![Test][test-img]][test]
88
[![Security][security-test-img]][security-test]
9+
[![CNTi essential][cnti-img]][cnti]
910
[![License: Apache-2.0][license-img]][license]
1011

1112
</div>
@@ -283,5 +284,7 @@ This project is licensed under the [Apache License 2.0](https://www.apache.org/l
283284
[test-img]: https://github.com/edgecomllc/eupf/actions/workflows/test.yml/badge.svg
284285
[security-test]: https://github.com/edgecomllc/eupf/actions/workflows/security-scan.yml
285286
[security-test-img]: https://github.com/edgecomllc/eupf/actions/workflows/security-scan.yml/badge.svg
287+
[cnti]: https://github.com/edgecomllc/eupf/actions/workflows/cnti.yml
288+
[cnti-img]: https://github.com/edgecomllc/eupf/raw/badges/cnti-badge.svg
286289
[license]: https://github.com/edgecomllc/eupf/blob/main/LICENSE
287290
[license-img]: https://img.shields.io/badge/License-Apache%202.0-blue.svg

0 commit comments

Comments
 (0)