Skip to content

Datapath BPF Complexity (ci-verifier) #338

Datapath BPF Complexity (ci-verifier)

Datapath BPF Complexity (ci-verifier) #338

name: Datapath BPF Complexity (ci-verifier)
# Any change in triggers needs to be reflected in the concurrency group.
on:
workflow_dispatch:
inputs:
PR-number:
description: "Pull request number."
required: true
context-ref:
description: "Context in which the workflow runs. If PR is from a fork, will be the PR target branch (general case). If PR is NOT from a fork, will be the PR branch itself (this allows committers to test changes to workflows directly from PRs)."
required: true
SHA:
description: "SHA under test (head of the PR branch)."
required: true
extra-args:
description: "[JSON object] Arbitrary arguments passed from the trigger comment via regex capture group. Parse with 'fromJson(inputs.extra-args).argName' in workflow."
required: false
default: '{}'
# Run every 6 hours
schedule:
- cron: '0 5/6 * * *'
# By specifying the access of one of the scopes, all of those that are not
# specified are set to 'none'.
permissions:
# To be able to access the repository with actions/checkout
contents: read
# To allow retrieving information from the PR API
pull-requests: read
# To be able to set commit status
statuses: write
concurrency:
# Structure:
# - Workflow name
# - Event type
# - A unique identifier depending on event type:
# - schedule: SHA
# - workflow_dispatch: PR number
#
# This structure ensures a unique concurrency group name is generated for each
# type of testing, such that re-runs will cancel the previous run.
group: |
${{ github.workflow }}
${{ github.event_name }}
${{
(github.event_name == 'schedule' && github.sha) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.PR-number)
}}
cancel-in-progress: true
env:
check_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
jobs:
commit-status-start:
runs-on: ubuntu-latest
steps:
- name: Set initial commit status
uses: myrotvorets/set-commit-status-action@243b4f7e597f62335408d58001edf8a02cf3e1fd # v1.1.7
with:
sha: ${{ inputs.SHA || github.sha }}
setup-and-test:
runs-on: ubuntu-latest-4cores-16gb
name: Setup & Test
strategy:
fail-fast: false
matrix:
include:
- kernel: '4.19-20230420.212204'
ci-kernel: '419'
- kernel: '5.4-20230420.212204'
ci-kernel: '54'
- kernel: '5.10-20230420.212204'
ci-kernel: '510'
- kernel: '5.15-20230420.212204'
ci-kernel: '510'
- kernel: 'bpf-next-20230420.212204'
ci-kernel: 'netnext'
timeout-minutes: 60
steps:
- name: Checkout pull request
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ inputs.SHA || github.sha }}
persist-credentials: false
- name: Provision LVH VMs
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
test-name: datapath-bpf-complexity
image: 'complexity-test'
image-version: ${{ matrix.kernel }}
host-mount: ./
cpu: 4
dns-resolver: '1.1.1.1'
install-dependencies: 'true'
cmd: |
git config --global --add safe.directory /host
uname -a
- name: Run verifier tests
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
cd /host/
# Run with cgo disabled, LVH images don't ship with gcc.
CGO_ENABLED=0 go test -v -parallel=1 ./test/verifier -cilium-base-path /host -ci-kernel-version ${{ matrix.ci-kernel }}
- name: Fetch artifacts
if: ${{ !success() }}
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
cd /host
mkdir datapath-verifier
cp bpf/*.o datapath-verifier
find test/verifier -name "*.log" -exec cp {} datapath-verifier/ \;
- name: Upload artifacts
if: ${{ !success() }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: datapath-verifier_${{ matrix.kernel }}
path: datapath-verifier
retention-days: 5
commit-status-final:
if: ${{ always() }}
needs: setup-and-test
runs-on: ubuntu-latest
steps:
- name: Set final commit status
uses: myrotvorets/set-commit-status-action@243b4f7e597f62335408d58001edf8a02cf3e1fd # v1.1.7
with:
sha: ${{ inputs.SHA || github.sha }}
status: ${{ needs.setup-and-test.result }}