-
Notifications
You must be signed in to change notification settings - Fork 40
164 lines (140 loc) · 5.51 KB
/
Copy pathci.yaml
File metadata and controls
164 lines (140 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# CI - Lint, test, and build for all modules
#
# Runs on PRs and pushes to main/release branches.
# Covers the AuthProxy Go module and Python tests.
#
name: CI
on:
pull_request:
branches:
- main
- "release-*"
push:
branches:
- main
permissions:
contents: read
jobs:
pre-commit:
name: Pre-commit Checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: authbridge/authlib/go.mod
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
# TODO: Remove continue-on-error after fixing pre-existing style issues repo-wide
continue-on-error: true
env:
SKIP: ai-assisted-by-trailer
go-ci-authlib:
name: Go CI (authlib)
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: authbridge/authlib
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: authbridge/authlib/go.mod
cache-dependency-path: authbridge/authlib/go.sum
- name: Lint
run: |
go fmt ./...
go vet ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -race -cover ./...
go-ci-authbridge-cmd:
name: Go CI (authbridge ${{ matrix.binary }})
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
binary:
- authbridge-proxy
- authbridge-envoy
defaults:
run:
working-directory: authbridge/cmd/${{ matrix.binary }}
env:
# Disable go.work so each cmd/* module resolves authlib via its own
# `replace` directive in go.mod (the workspace would otherwise pull
# all sibling modules in and slow down CI).
GOWORK: "off"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: authbridge/cmd/${{ matrix.binary }}/go.mod
cache-dependency-path: authbridge/cmd/${{ matrix.binary }}/go.sum
- name: Lint
run: |
go fmt ./...
go vet ./...
- name: Build
run: go build -v ./...
# The authbridge-lite image is this same authbridge-proxy binary built
# with exclude_plugin_* tags (only jwt-validation + token-exchange).
# Build AND test that tag set on every PR — build.yaml only exercises
# it on tag/main pushes, and this guards against lite-only regressions.
- name: Build + test lite variant (exclude_plugin_* tags)
if: matrix.binary == 'authbridge-proxy'
run: |
TAGS="exclude_plugin_a2aparser,exclude_plugin_ibac,exclude_plugin_inferenceparser"
TAGS="$TAGS,exclude_plugin_mcpparser,exclude_plugin_opa,exclude_plugin_sparc,exclude_plugin_tokenbroker"
TAGS="$TAGS,exclude_plugin_toolprune"
go build -v -tags "$TAGS" ./...
go test -v -race -cover -tags "$TAGS" ./...
- name: Test
run: go test -v -race -cover ./...
proxy-init-iptables:
name: proxy-init iptables rules
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# This job runs a repo script as root via `sudo -E` and needs no git
# access afterwards, so don't leave the job token in .git/config.
persist-credentials: false
# The harness builds its rules inside `unshare --net`, so it never touches
# the runner's own networking. It needs root for unshare + iptables, the
# dummy module to generate a routable external packet, and both iptables
# backends so the legacy-detection case is exercised rather than skipped.
- name: Install iptables backends
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq iptables iproute2 kmod
sudo modprobe dummy || echo "dummy module unavailable; capture packet may not be generated"
# Gates the interception rules themselves: chain placement and ordering,
# the DNS carve-out, the non-TCP drop, the fail-closed guards, and — for
# transparent inbound — that the ambient DNAT precedes AB_REDIRECT's
# ztunnel-mark RETURN. That ordering decides whether mesh-delivered traffic
# is validated or waved through, and nothing else in CI covers it.
- name: Test enforce-redirect + transparent inbound rules
run: sudo -E authbridge/proxy-init/test-enforce-redirect.sh
python-test:
name: Python Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install pytest==8.* python-keycloak==5.3.1 pyjwt==2.10.1 pyyaml==6.*
- name: Run tests
run: pytest tests/ -v -x --ignore=tests/e2e