-
Notifications
You must be signed in to change notification settings - Fork 511
feat(ci): Restructure CI #2771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AryanBakliwal
wants to merge
1
commit into
kubearmor:main
Choose a base branch
from
AryanBakliwal:restructure-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(ci): Restructure CI #2771
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: ci-test-ebpf | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: read-all | ||
|
|
||
| jobs: | ||
| ebpf-tests: | ||
| name: Run eBPF Tests | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 | ||
| with: | ||
| go-version-file: 'KubeArmor/go.mod' | ||
|
|
||
| - name: Install necessary dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get -y install build-essential libelf-dev pkg-config net-tools linux-headers-$(uname -r) linux-tools-$(uname -r) libbpf-dev unzip protobuf-compiler | ||
|
|
||
| go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | ||
| go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | ||
|
|
||
| export arch=$(uname -m) | ||
| export bpftool_version=v7.2.0 | ||
| if [[ "$arch" == "aarch64" ]]; then | ||
| arch=arm64; | ||
| elif [[ "$arch" == "x86_64" ]]; then | ||
| arch=amd64; | ||
| fi | ||
| curl -LO https://github.com/libbpf/bpftool/releases/download/$bpftool_version/bpftool-$bpftool_version-$arch.tar.gz && \ | ||
| sudo tar -xzf bpftool-$bpftool_version-$arch.tar.gz -C /usr/local/bin && \ | ||
| sudo chmod +x /usr/local/bin/bpftool | ||
|
|
||
| - name: Install the latest LLVM toolchain | ||
| run: ./.github/workflows/install-llvm.sh | ||
|
|
||
| - name: Compile libbpf | ||
| run: ./.github/workflows/install-libbpf.sh | ||
|
|
||
| - name: Compile eBPF Bytecode | ||
| working-directory: KubeArmor/BPF | ||
| run: make | ||
|
|
||
| - name: Load eBPF Bytecode | ||
| working-directory: KubeArmor/monitor | ||
| run: sudo -E go run ci_load.go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,182 @@ | ||
| name: KubeArmor CI | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: read-all | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| jobs: | ||
|
|
||
| detect-changes: | ||
| name: "Detect changed files" | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| go: ${{ steps.filter.outputs.go_any_changed }} | ||
| ebpf: ${{ steps.filter.outputs.ebpf_any_changed }} | ||
| codespell: ${{ steps.filter.outputs.codespell_any_changed }} | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Filter Repository Paths | ||
| uses: tj-actions/changed-files@v44 | ||
| id: filter | ||
| with: | ||
| files_yaml: | | ||
| go: | ||
| - 'KubeArmor/**' | ||
| - 'pkg/**' | ||
| - 'protobuf/**' | ||
| - 'deployments/helm/**' | ||
| - 'deployments/get/**' | ||
| - 'tests/**' | ||
| - 'examples/multiubuntu/build/**' | ||
| - '.github/workflows/ci-test-go.yml' | ||
| - '.github/workflows/ci-test-ubi-image.yml' | ||
| - '.github/workflows/ci-test-ginkgo.yml' | ||
| - '.github/workflows/ci-test-systemd.yml' | ||
| - '.github/workflows/ci-test-network-tests.yml' | ||
| - '.github/workflows/ci-test-controllers.yml' | ||
| - '.github/workflows/ci-test-operator.yaml' | ||
| ebpf: | ||
| - 'KubeArmor/BPF/**' | ||
| - '.github/workflows/ci-test-ebpf.yml' | ||
| - 'KubeArmor/enforcer/**/*.o' | ||
| codespell: | ||
| - '.codespellrc' | ||
| - '.github/workflows/ci-codespell.yml' | ||
| - '**/*.go' | ||
| - '**/*.md' | ||
| - '**/*.yaml' | ||
| - '**/*.yml' | ||
| - '**/*.sh' | ||
| - '**/*.txt' | ||
| - '**/*.c' | ||
| - '**/*.h' | ||
|
|
||
| license: | ||
| name: "License Header" | ||
| needs: [detect-changes] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Check License Header | ||
| uses: apache/skywalking-eyes@ed436a5593c63a25f394ea29da61b0ac3731a9fe | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| codespell: | ||
| name: "Spell Check" | ||
| needs: [detect-changes] | ||
| if: ${{ needs.detect-changes.outputs.codespell == 'true' }} | ||
| uses: ./.github/workflows/ci-codespell.yml | ||
|
|
||
| go-tests: | ||
| name: "Go Tests" | ||
| if: | | ||
| always() && | ||
| (needs.codespell.result == 'success' || needs.codespell.result == 'skipped') && | ||
| (needs.license.result == 'success') && | ||
| needs.detect-changes.outputs.go == 'true' | ||
| needs: [detect-changes, license, codespell] | ||
| uses: ./.github/workflows/ci-test-go.yml | ||
|
|
||
| ebpf-tests: | ||
| name: "eBPF Tests" | ||
| if: | | ||
| always() && | ||
| (needs.codespell.result == 'success' || needs.codespell.result == 'skipped') && | ||
| (needs.license.result == 'success') && | ||
| needs.detect-changes.outputs.ebpf == 'true' | ||
| needs: [detect-changes, license, codespell] | ||
| uses: ./.github/workflows/ci-test-ebpf.yml | ||
|
|
||
| matrix-tests: | ||
| name: "Ginkgo Tests - K8s" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-test-ginkgo.yml | ||
|
|
||
| matrix-tests-ubi: | ||
| name: "Ginkgo Tests (UBI) - K8s" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-test-ubi-image.yml | ||
|
|
||
| matrix-tests-systemd: | ||
| name: "Ginkgo Tests - Systemd" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-test-systemd.yml | ||
|
|
||
| matrix-tests-network: | ||
| name: "Ginkgo Tests (Network) - K8s" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-network-tests.yml | ||
|
|
||
| matrix-tests-controller: | ||
| name: "Ginkgo Tests (Controller) - K8s" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-test-controllers.yml | ||
|
|
||
| build-test-operator: | ||
| name: "Build Test - Operator" | ||
| needs: [detect-changes, go-tests, ebpf-tests] | ||
| if: | | ||
| always() && | ||
| (needs.go-tests.result == 'success' || needs.go-tests.result == 'skipped') && | ||
| (needs.ebpf-tests.result == 'success' || needs.ebpf-tests.result == 'skipped') && | ||
| (needs.go-tests.result == 'success' || needs.ebpf-tests.result == 'success') | ||
| uses: ./.github/workflows/ci-test-operator.yaml | ||
|
|
||
| matrix-composite-result: | ||
| name: Matrix Tests - Composite result | ||
| if: ${{ always() }} | ||
| needs: | ||
| - matrix-tests | ||
| - matrix-tests-ubi | ||
| - matrix-tests-systemd | ||
| - matrix-tests-network | ||
| - matrix-tests-controller | ||
| - build-test-operator | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: | | ||
| # If any required matrix job failed, this job fails. | ||
| # If they were successfully executed or cleanly skipped, this job passes. | ||
| if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | ||
| echo "One or more matrix tests failed or were cancelled." | ||
| exit 1 | ||
| else | ||
| echo "All matrix tests passed or were safely skipped." | ||
| exit 0 | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.