Skip to content

Commit 9b6e1a9

Browse files
vakalapamainredcamrynlsnguyen64jimassa
committed
Initial public release of retina
Signed-off-by: Vamsi Kalapala <[email protected]> Co-authored-by: Qingchuan Hao <[email protected]> Co-authored-by: Camryn Lee <[email protected]> Co-authored-by: Steven Nguyen <[email protected]> Co-authored-by: Jacques I Massa <[email protected]> Co-authored-by: Anubhab Majumdar <[email protected]> Co-authored-by: Mathew Merrick <[email protected]> Co-authored-by: Tamilmana Manoharan <[email protected]> Co-authored-by: Quang Nguyen <[email protected]> Co-authored-by: Hunter Gregory <[email protected]> Co-authored-by: Anson Qian <[email protected]> Co-authored-by: Evan Baker <[email protected]> Co-authored-by: Isaiah Raya <[email protected]> Co-authored-by: Tatsinnit <[email protected]> Co-authored-by: Pengfei Ni <[email protected]> Co-authored-by: David Schott <[email protected]> Co-authored-by: Jaeryn <[email protected]> Co-authored-by: Spencer McKee <[email protected]> Co-authored-by: Khushbu-Parekh <[email protected]> Co-authored-by: Prabhakaran S <[email protected]> Co-authored-by: Will Daly <[email protected]> Co-authored-by: Tim Raymond <[email protected]> Co-authored-by: Neha Aggarwal <[email protected]>
0 parents  commit 9b6e1a9

File tree

538 files changed

+361402
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

538 files changed

+361402
-0
lines changed

.github/.markdownlint.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"MD013": false,
3+
"MD010": false,
4+
"MD024": {
5+
"siblings_only": true
6+
}
7+
}

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @microsoft/retina

.github/dependabot.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
reviewers:
8+
- "microsoft/retina"
9+
commit-message:
10+
prefix: "ci"
11+
labels: [ "ci", "dependencies" ]
12+
open-pull-requests-limit: 10
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "daily"
17+
reviewers:
18+
- "microsoft/retina"
19+
commit-message:
20+
prefix: "ci"
21+
labels: [ "ci", "dependencies" ]
22+
open-pull-requests-limit: 10
23+
- package-ecosystem: "gomod"
24+
directory: "/"
25+
schedule:
26+
interval: "daily"
27+
reviewers:
28+
- "microsoft/retina"
29+
commit-message:
30+
prefix: "deps"
31+
ignore:
32+
- dependency-name: "github.com/inspektor-gadget/inspektor-gadget"
33+
open-pull-requests-limit: 10

.github/workflows/codeql.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "CodeQL"
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
jobs:
9+
analyze:
10+
name: Analyze
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, windows-latest]
15+
language: [go]
16+
go-version: ["1.21"]
17+
runs-on: ${{ matrix.os }}
18+
timeout-minutes: 60
19+
permissions:
20+
actions: read
21+
contents: read
22+
security-events: write
23+
steps:
24+
- name: Setup go
25+
uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ matrix.go-version }}
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v3
32+
with:
33+
languages: ${{ matrix.language }}
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@v3
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@v3
38+
with:
39+
category: "/language:${{matrix.language}}"

.github/workflows/commit-message.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: commit-message
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
types:
8+
- opened
9+
- synchronize
10+
- edited
11+
- reopened
12+
jobs:
13+
commit-message:
14+
runs-on: ubuntu-20.04
15+
steps:
16+
- name: verify_commit_message
17+
run: |
18+
if [[ "${{ github.event_name }}" == pull_request ]]; then
19+
commit_msg_header="${{ github.event.pull_request.title }}"
20+
else
21+
# get first line of commit message
22+
commit_msg_header=`echo "${{ github.event.head_commit.message }}" | head -n 1`
23+
fi
24+
25+
commit_msg_type_regex='feat|fix|refactor|style|test|docs|build|tool|chore|deps'
26+
commit_msg_scope_regex='.{1,20}'
27+
commit_msg_subject_regex='.{1,150}'
28+
commit_msg_regex="^(${commit_msg_type_regex})(\(${commit_msg_scope_regex}\))?: (${commit_msg_subject_regex})\$"
29+
merge_msg_regex="^Merge branch '.+' into .+\$"
30+
full_regex="(${commit_msg_regex})|(${merge_msg_regex})"
31+
32+
echo $commit_msg_header | grep -qP "$full_regex" || {
33+
echo "ERROR: Invalid commit message header. Please fix format of your PR title or the commit pushed to main."
34+
echo "Current value:"
35+
echo "$commit_msg_header"
36+
echo
37+
echo "Examples of valid commits:"
38+
echo 'example 1: "feat(cli): new feature"'
39+
echo 'example 2: "fix(advanced-metrics): bug fix"'
40+
echo 'example 3: "docs: update readme"'
41+
echo
42+
echo "Valid types are: $commit_msg_type_regex"
43+
echo "For more details, see .github/workflows/commit-message.yaml"
44+
exit 1
45+
}

.github/workflows/docs.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Build and Deploy Retina.sh
3+
on:
4+
push:
5+
branches: ["docs", "main", "ghpages"]
6+
workflow_dispatch:
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
concurrency:
12+
group: "pages"
13+
cancel-in-progress: false
14+
jobs:
15+
deploy:
16+
environment:
17+
name: retina.sh
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
- name: Setup Pages
24+
uses: actions/configure-pages@v3
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 20
28+
- name: build
29+
run: |
30+
npm install --prefix site/
31+
npm run build --prefix site/
32+
- name: Upload artifact
33+
uses: actions/upload-pages-artifact@v1
34+
with:
35+
path: "./site/build"
36+
- name: Deploy to GitHub Pages
37+
id: deployment
38+
uses: actions/deploy-pages@v1

.github/workflows/golangci-lint.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: golangci-lint
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
jobs:
9+
golangci:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
go-version: ['1.21.x']
14+
os: [ubuntu-latest, windows-latest]
15+
name: Lint
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version: ${{ matrix.go-version }}
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: golangci-lint
25+
uses: golangci/golangci-lint-action@v4
26+
with:
27+
version: v1.55
28+
args: --concurrency 4 --verbose --new-from-rev=origin/master --config=.golangci.yml --timeout=25m
29+
only-new-issues: true
30+
skip-cache: true

.github/workflows/images.yaml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Build and Publish Retina Container Images
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
images:
11+
name: Build Images
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
platform: ["linux"]
17+
arch: ["amd64", "arm64"]
18+
component: ["agent", "operator"]
19+
20+
# required for AZ login/SP
21+
permissions:
22+
id-token: write
23+
contents: read
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
29+
- uses: actions/setup-go@v4
30+
with:
31+
go-version: ">=1.21.0"
32+
- run: go version
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v3
36+
37+
- name: Az CLI login
38+
uses: azure/login@v1
39+
with:
40+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
41+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
42+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
43+
44+
- name: Build/Push Images
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
az acr login -n ${{ secrets.ACR_NAME }}
49+
echo "TAG=$(make version)" >> $GITHUB_ENV
50+
make build PLATFORMS=${{ matrix.platform }}/${{ matrix.arch }} COMPONENT=${{ matrix.component }}
51+
52+
53+
manifests:
54+
name: Generate Manifests
55+
runs-on: ubuntu-latest
56+
needs: images
57+
58+
strategy:
59+
matrix:
60+
component: ["agent", "operator"]
61+
62+
# required for AZ login/SP
63+
permissions:
64+
id-token: write
65+
contents: read
66+
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Set up QEMU
72+
uses: docker/setup-qemu-action@v3
73+
74+
- name: Az CLI login
75+
uses: azure/login@v1
76+
with:
77+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
78+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
79+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
80+
81+
- name: Generate Manifests
82+
shell: bash
83+
run: |
84+
set -euo pipefail
85+
az acr login -n ${{ secrets.ACR_NAME }}
86+
make manifest COMPONENT=${{ matrix.component }}

.github/workflows/integration.yaml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Integration Tests For Retina
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
integ-test:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Free up disk space
9+
run: |
10+
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
11+
# du -sh /* 2> /dev/null | sort -rh 2> /dev/null | head
12+
# du -h -d2 /usr 2> /dev/null | sort -rh 2> /dev/null | head
13+
echo "Check free disk space before cleanup."
14+
df -h
15+
echo "Removing non-essential tools and libraries."
16+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
17+
sudo rm -rf /opt/ghc
18+
sudo rm -rf /usr/share/dotnet
19+
sudo rm -rf /usr/local/share/boost
20+
# delete libraries for Android (12G), PowerShell (1.3G), Swift (1.7G)
21+
sudo rm -rf /usr/local/lib/android
22+
sudo rm -rf /usr/local/share/powershell
23+
sudo rm -rf /usr/share/swift
24+
echo "Check free disk space after cleanup."
25+
df -h
26+
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- uses: actions/setup-go@v2
31+
with:
32+
go-version: "^1.18"
33+
34+
- name: Make retina image
35+
run: |
36+
export CONTAINER_BUILDER=docker
37+
export CONTAINER_RUNTIME=docker
38+
make all-images-local
39+
make install-kubectl-retina
40+
make base-images-remove
41+
curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell
42+
chmod +x ./kubectl-node_shell
43+
sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell
44+
docker system prune -f
45+
46+
- name: Deploy Kind
47+
run: make kind-setup
48+
49+
- name: Install retina
50+
run: make kind-install
51+
52+
- name: Run tests
53+
run: make retina-integration
54+
55+
- name: Export Kubernetes logs
56+
if: failure()
57+
run: make retina-export-logs
58+
59+
- name: Archive Kubernetes logs
60+
if: failure()
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: kubernetes-node-logs
64+
path: kubernetes-logs
65+
66+
- name: Archive iptable and ipset
67+
if: failure()
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: iptable-ipset-snapshot
71+
path: ./test/integration/plugin-simulations/npm-iptables
72+
- name: Cleanup
73+
if: always()
74+
run: make kind-clean

.github/workflows/markdownlint.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Markdown Lint
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
markdownlint:
9+
name: markdownlint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
- uses: DavidAnson/markdownlint-cli2-action@v9
15+
with:
16+
command: config
17+
globs: |
18+
.github/.markdownlint.json
19+
**/*.md

0 commit comments

Comments
 (0)