Skip to content

Commit b265ce3

Browse files
committed
♻️👷 Use common tags for plugin inclusion/exclusion
Signed-off-by: Evaline Ju <69598118+evaline-ju@users.noreply.github.com>
1 parent 2b4cfbe commit b265ce3

12 files changed

Lines changed: 169 additions & 60 deletions

File tree

.github/workflows/build.yaml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@ jobs:
4747
dockerfile: cmd/authbridge-proxy/Dockerfile
4848

4949
# AuthBridge proxy-sidecar LITE image — the SAME authbridge-proxy
50-
# binary + Dockerfile, built with exclude_plugin_* tags so only
51-
# jwt-validation + token-exchange compile in (drops the OPA SDK
52-
# and the parsers, roughly halving the binary). A build variant,
53-
# not a separate binary. Same listener layout as the full proxy
54-
# image; not yet referenced by the operator's default config.
50+
# binary + Dockerfile, built with a trimmed plugin set (roughly
51+
# halving the binary). A build variant, not a separate binary.
52+
# GO_BUILD_TAGS is derived at step time from
53+
# authbridge/scripts/lite-tags rather than declared here, so
54+
# adding a plugin doesn't require editing this file.
5555
- name: authbridge-lite
5656
context: ./authbridge
5757
dockerfile: cmd/authbridge-proxy/Dockerfile
58-
build_args: |
59-
GO_BUILD_TAGS=exclude_plugin_a2aparser,exclude_plugin_ibac,exclude_plugin_inferenceparser,exclude_plugin_mcpparser,exclude_plugin_opa,exclude_plugin_sparc,exclude_plugin_tokenbroker,exclude_plugin_toolprune
6058

6159
# AuthBridge proxy-sidecar CPEX image — authbridge-proxy built
6260
# with -tags cpex (links libcpex_ffi.a from a pinned CPEX
@@ -79,6 +77,15 @@ jobs:
7977
- name: Checkout repository
8078
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
8179

80+
# 1b. Set up Go — needed by the buildargs step for authbridge-lite,
81+
# which derives GO_BUILD_TAGS from plugin source at build time.
82+
# Cheap to install for every matrix row (~1s of cache pull); no-op
83+
# for rows that don't need it.
84+
- name: Set up Go
85+
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
86+
with:
87+
go-version-file: authbridge/scripts/lite-tags/go.mod
88+
8289
# 2. Set up QEMU for multi-arch builds
8390
- name: Set up QEMU
8491
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
@@ -121,40 +128,52 @@ jobs:
121128
# Add 'latest' tag for version tags, workflow_dispatch, and pushes to main
122129
type=raw,value=latest,enable=${{ (github.ref_type == 'tag' && startsWith(github.ref_name, 'v')) || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' }}
123130
124-
# 6b. Resolve build-args. authbridge-cpex needs CPEX_FFI_VERSION
125-
# (the release tag) and CPEX_FFI_ABI (the FFI ABI integer the
126-
# linked lib must report) — both read from the files next to its
127-
# Dockerfile and asserted against the tarball at build time. Other
128-
# images leave this empty (an undeclared build-arg is ignored).
131+
# 6b. Resolve per-image build-args.
132+
# authbridge-cpex: CPEX_FFI_VERSION (release tag) and CPEX_FFI_ABI
133+
# (integer the linked lib must report), read from the files
134+
# next to its Dockerfile and asserted at build time.
135+
# authbridge-lite: GO_BUILD_TAGS, derived from plugin source
136+
# (authbridge/scripts/lite-tags) so the list stays in sync
137+
# without hand-maintenance.
138+
# Other images leave args empty (an undeclared build-arg is
139+
# ignored).
129140
- name: Resolve build args
130141
id: buildargs
131142
run: |
132-
if [[ "${{ matrix.image_config.name }}" == "authbridge-cpex" ]]; then
133-
VERSION="$(tr -d '[:space:]' < authbridge/cmd/authbridge-cpex/CPEX_FFI_VERSION)"
134-
ABI="$(tr -d '[:space:]' < authbridge/cmd/authbridge-cpex/CPEX_FFI_ABI)"
135-
{
136-
echo "args<<EOF"
137-
echo "CPEX_FFI_VERSION=${VERSION}"
138-
echo "CPEX_FFI_ABI=${ABI}"
139-
echo "EOF"
140-
} >> "$GITHUB_OUTPUT"
141-
else
142-
echo "args=" >> "$GITHUB_OUTPUT"
143-
fi
143+
case "${{ matrix.image_config.name }}" in
144+
authbridge-cpex)
145+
VERSION="$(tr -d '[:space:]' < authbridge/cmd/authbridge-cpex/CPEX_FFI_VERSION)"
146+
ABI="$(tr -d '[:space:]' < authbridge/cmd/authbridge-cpex/CPEX_FFI_ABI)"
147+
{
148+
echo "args<<EOF"
149+
echo "CPEX_FFI_VERSION=${VERSION}"
150+
echo "CPEX_FFI_ABI=${ABI}"
151+
echo "EOF"
152+
} >> "$GITHUB_OUTPUT"
153+
;;
154+
authbridge-lite)
155+
TAGS=$(go -C authbridge/scripts/lite-tags run .)
156+
{
157+
echo "args<<EOF"
158+
echo "GO_BUILD_TAGS=${TAGS}"
159+
echo "EOF"
160+
} >> "$GITHUB_OUTPUT"
161+
;;
162+
*)
163+
echo "args=" >> "$GITHUB_OUTPUT"
164+
;;
165+
esac
144166
145167
# 7. Build and push image
146168
- name: Build and push ${{ matrix.image_config.name }}
147169
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
148170
with:
149171
context: ${{ matrix.image_config.context }}
150172
file: ${{ matrix.image_config.context }}/${{ matrix.image_config.dockerfile }}
151-
# Merge both build-arg sources into a single key: static per-image
152-
# args from the matrix (e.g. authbridge-lite GO_BUILD_TAGS) plus the
153-
# dynamically resolved args (authbridge-cpex CPEX_FFI_*). A duplicate
154-
# `build-args:` key is invalid YAML and fails the whole workflow; only
155-
# one image sets each source, so concatenating them is safe.
173+
# Dynamically-resolved args from step 6b: authbridge-cpex
174+
# (CPEX_FFI_*) and authbridge-lite (GO_BUILD_TAGS from
175+
# scripts/lite-tags). Other images resolve to empty.
156176
build-args: |
157-
${{ matrix.image_config.build_args }}
158177
${{ steps.buildargs.outputs.args }}
159178
push: true
160179
platforms: linux/amd64,linux/arm64

.github/workflows/ci.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ jobs:
107107
- name: Build + test lite variant (exclude_plugin_* tags)
108108
if: matrix.binary == 'authbridge-proxy'
109109
run: |
110-
TAGS="exclude_plugin_a2aparser,exclude_plugin_ibac,exclude_plugin_inferenceparser"
111-
TAGS="$TAGS,exclude_plugin_mcpparser,exclude_plugin_opa,exclude_plugin_sparc,exclude_plugin_tokenbroker"
112-
TAGS="$TAGS,exclude_plugin_toolprune"
110+
TAGS=$(go -C ../../scripts/lite-tags run .)
113111
go build -v -tags "$TAGS" ./...
114112
go test -v -race -cover -tags "$TAGS" ./...
115113

.github/workflows/release-binaries.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ jobs:
5252
# authbridge-proxy variants: "<suffix>:<build-tags>". Empty
5353
# suffix is the default plugin set. One variant per opt-in
5454
# plugin (or one combined "full") — never enumerate combos.
55-
lite_tags="exclude_plugin_a2aparser,exclude_plugin_ibac"
56-
lite_tags="${lite_tags},exclude_plugin_inferenceparser"
57-
lite_tags="${lite_tags},exclude_plugin_mcpparser,exclude_plugin_opa"
58-
lite_tags="${lite_tags},exclude_plugin_sparc,exclude_plugin_tokenbroker"
55+
# Lite tags are derived from plugin source; see
56+
# authbridge/scripts/lite-tags.
57+
lite_tags=$(go -C authbridge/scripts/lite-tags run .)
5958
declare -a proxy_variants=(
6059
":"
6160
"lite:${lite_tags}"
@@ -112,7 +111,7 @@ jobs:
112111
add ''
113112
add '`authbridge-proxy` ships in variants matching the container images:'
114113
add 'unqualified (default plugin set, matches the `authbridge` image),'
115-
add '`-lite` (auth-only, matches `authbridge-lite`), plus one variant per'
114+
add '`-lite` (trimmed plugin set, matches `authbridge-lite`), plus one variant per'
116115
add 'opt-in plugin currently offered for try-out (today: `-sessionbudget`).'
117116
add 'Variants track opt-in plugins one-for-one; arbitrary combinations are not published.'
118117
add ''

CLAUDE.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Two mode-specific binaries (proxy, envoy), one Dockerfile each; the `authbridge-
125125
|--------|------|-----------|---------|
126126
| `cmd/authbridge-proxy/` | proxy-sidecar (default) | HTTP forward + reverse proxies | full (incl. parsers) |
127127
| `cmd/authbridge-envoy/` | envoy-sidecar | gRPC ext_proc on :9090 | full (incl. parsers) |
128-
| `authbridge-lite` _(image: proxy + `exclude_plugin_*`)_ | proxy-sidecar | HTTP forward + reverse proxies | auth-only (jwt-validation + token-exchange; OPA + parsers dropped) |
128+
| `authbridge-lite` _(image: proxy + `exclude_plugin_*`)_ | proxy-sidecar | HTTP forward + reverse proxies | trimmed plugin set (see `authbridge/scripts/lite-tags`) |
129129

130130
**Go modules:**
131131
- `authbridge/authlib/` — pure library: validation, exchange, cache, bypass, spiffe, routing, auth, config, all listener implementations, all plugins.
@@ -139,7 +139,7 @@ Two mode-specific binaries (proxy, envoy), one Dockerfile each; the `authbridge-
139139
| Workflow | Trigger | Purpose |
140140
|----------|---------|---------|
141141
| `ci.yaml` | PR to main/release-* | Pre-commit, Go fmt/vet/build/test for authlib and the cmd/authbridge-* binaries; Python tests |
142-
| `build.yaml` | Tag push (`v*`) or manual | Multi-arch Docker builds for: proxy-init, authbridge (proxy-sidecar combined), authbridge-envoy (envoy-sidecar combined), authbridge-lite (proxy Dockerfile built with `exclude_plugin_*` tags — auth-only) |
142+
| `build.yaml` | Tag push (`v*`) or manual | Multi-arch Docker builds for: proxy-init, authbridge (proxy-sidecar combined), authbridge-envoy (envoy-sidecar combined), authbridge-lite (proxy Dockerfile built with `exclude_plugin_*` tags from `authbridge/scripts/lite-tags`) |
143143
| `security-scans.yaml` | PR to main | Dependency review, shellcheck, YAML lint, Hadolint, Bandit, Trivy, CodeQL |
144144
| `scorecard.yaml` | Weekly / push to main | OpenSSF Scorecard security health metrics |
145145
| `spellcheck_action.yml` | PR | Spellcheck on markdown files |
@@ -170,7 +170,7 @@ All images are pushed to `ghcr.io/rossoctl/cortex/` from
170170
|-------|--------|-------------|
171171
| **`authbridge`** | **`authbridge/cmd/authbridge-proxy/Dockerfile`** | **proxy-sidecar combined image (default mode): authbridge-proxy (full plugin set incl. parsers) + spiffe-helper. No Envoy.** |
172172
| `authbridge-envoy` | `authbridge/cmd/authbridge-envoy/Dockerfile` | envoy-sidecar combined image: Envoy + authbridge-envoy (ext_proc, full plugin set) + spiffe-helper |
173-
| `authbridge-lite` | `authbridge/cmd/authbridge-proxy/Dockerfile` (+ `GO_BUILD_TAGS=exclude_plugin_*`) | proxy-sidecar combined image built auth-only (jwt-validation + token-exchange; OPA + parsers dropped) + spiffe-helper. A build variant of `authbridge`, not a separate binary; not yet referenced by the operator's default config |
173+
| `authbridge-lite` | `authbridge/cmd/authbridge-proxy/Dockerfile` (+ `GO_BUILD_TAGS=exclude_plugin_*`) | proxy-sidecar combined image with a trimmed plugin set (see `authbridge/scripts/lite-tags`), plus spiffe-helper. A build variant of `authbridge`, not a separate binary; not yet referenced by the operator's default config |
174174
| `authbridge-cpex` | `authbridge/cmd/authbridge-cpex/Dockerfile` | proxy-sidecar build with the CPEX plugin: authbridge-proxy built with `-tags cpex`, links `libcpex_ffi.a` from a pinned CPEX release (CGO_ENABLED=1). Routes hooks through the CPEX framework (APL DSL + named CPEX policy plugins). FFI ABI version is read from `authbridge/cmd/authbridge-cpex/CPEX_FFI_VERSION` |
175175
| `proxy-init` | `authbridge/proxy-init/Dockerfile.init` | Alpine + iptables init container (envoy-sidecar + proxy-sidecar enforce-redirect modes) |
176176

@@ -252,9 +252,11 @@ cd authbridge/proxy-init && make docker-build-init
252252
# Combined sidecars (proxy-sidecar default / envoy-sidecar)
253253
cd authbridge && podman build -f cmd/authbridge-proxy/Dockerfile -t authbridge:latest .
254254
cd authbridge && podman build -f cmd/authbridge-envoy/Dockerfile -t authbridge-envoy:latest .
255-
# authbridge-lite: same proxy Dockerfile, built with exclude_plugin_* tags (auth-only)
256-
cd authbridge && podman build -f cmd/authbridge-proxy/Dockerfile \
257-
--build-arg GO_BUILD_TAGS="exclude_plugin_a2aparser,exclude_plugin_ibac,exclude_plugin_inferenceparser,exclude_plugin_mcpparser,exclude_plugin_opa,exclude_plugin_sparc,exclude_plugin_tokenbroker,exclude_plugin_toolprune" \
255+
# authbridge-lite: same proxy Dockerfile, built with the trimmed
256+
# plugin set derived from plugin source by
257+
# authbridge/scripts/lite-tags.
258+
cd authbridge && LITE_TAGS=$(go -C scripts/lite-tags run .) && podman build -f cmd/authbridge-proxy/Dockerfile \
259+
--build-arg GO_BUILD_TAGS="${LITE_TAGS}" \
258260
-t authbridge-lite:latest .
259261
```
260262

authbridge/CLAUDE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ships in variants that mirror the container images:
4545
| Variant | Tarball name shape | Matches |
4646
|---|---|---|
4747
| unqualified (default plugins) | `authbridge-proxy_<ver>_<os>_<arch>.tar.gz` | `authbridge` image |
48-
| `-lite` (drops the OPA SDK and the protocol parsers) | `authbridge-proxy-lite_<ver>_<os>_<arch>.tar.gz` | `authbridge-lite` image |
48+
| `-lite` (trimmed plugin set — see `authbridge/scripts/lite-tags`) | `authbridge-proxy-lite_<ver>_<os>_<arch>.tar.gz` | `authbridge-lite` image |
4949
| `-sessionbudget` (default + opt-in session-budget) | `authbridge-proxy-sessionbudget_<ver>_<os>_<arch>.tar.gz` | no image today |
5050

5151
One variant per opt-in plugin currently offered for try-out (today:
@@ -411,9 +411,11 @@ make load-image # Uses KIND_CLUSTER_NAME env var (default: r
411411
cd ..
412412
podman build -f cmd/authbridge-proxy/Dockerfile -t authbridge:latest . # proxy-sidecar (default)
413413
podman build -f cmd/authbridge-envoy/Dockerfile -t authbridge-envoy:latest . # envoy-sidecar
414-
# authbridge-lite: the proxy Dockerfile built with exclude_plugin_* tags (auth-only)
414+
# authbridge-lite: the proxy Dockerfile built with a trimmed plugin
415+
# set derived from plugin source by scripts/lite-tags.
416+
LITE_TAGS=$(go -C scripts/lite-tags run .)
415417
podman build -f cmd/authbridge-proxy/Dockerfile \
416-
--build-arg GO_BUILD_TAGS="exclude_plugin_a2aparser,exclude_plugin_ibac,exclude_plugin_inferenceparser,exclude_plugin_mcpparser,exclude_plugin_opa,exclude_plugin_sparc,exclude_plugin_tokenbroker,exclude_plugin_toolprune" \
418+
--build-arg GO_BUILD_TAGS="${LITE_TAGS}" \
417419
-t authbridge-lite:latest .
418420
kind load docker-image authbridge:latest --name rossoctl
419421
kind load docker-image authbridge-envoy:latest --name rossoctl

authbridge/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ Two container images are published:
4040
|-------|----------|
4141
| `authbridge` | proxy-sidecar combined: authbridge-proxy binary + bundled spiffe-helper |
4242
| `authbridge-envoy` | envoy-sidecar combined: Envoy + ext_proc + bundled spiffe-helper |
43-
| `authbridge-lite` | `authbridge-proxy` built with `exclude_plugin_*` tags — auth-only (jwt-validation + token-exchange; OPA + parsers dropped). A build variant, not a separate binary |
43+
| `authbridge-lite` | `authbridge-proxy` built with `exclude_plugin_*` tags from `authbridge/scripts/lite-tags` (trimmed plugin set). A build variant, not a separate binary |
4444

4545
| Mode | Image | Use Case | How It Works |
4646
|------|-------|----------|-------------|
4747
| `proxy-sidecar` (default) | `authbridge` | HTTP_PROXY-based forward + reverse proxies | Agent routes outbound traffic through forward proxy; reverse proxy validates inbound JWTs |
4848
| `envoy-sidecar` | `authbridge-envoy` | Transparent interception via iptables | Envoy intercepts all traffic, delegates auth to authbridge via ext_proc gRPC |
49-
| `lite` | `authbridge-lite` | The `authbridge-proxy` binary built with `exclude_plugin_*` tags (auth-only: jwt-validation + token-exchange) | For size-constrained deployments that don't need protocol-aware session events |
49+
| `lite` | `authbridge-lite` | The `authbridge-proxy` binary built with `exclude_plugin_*` tags from `authbridge/scripts/lite-tags` (trimmed plugin set) | For size-constrained deployments that don't need protocol-aware session events |
5050

5151
The operator resolves the mode per workload from `AgentRuntime.Spec.AuthBridgeMode` → namespace ConfigMap → deprecated `rossoctl.io/authbridge-mode` annotation → cluster default (`proxy-sidecar`). See operator#361.
5252

@@ -480,7 +480,7 @@ plugin package from being imported and compiled into the binary.
480480
- [authlib](authlib/README.md) — Shared auth building blocks (Go library)
481481
- [cmd/authbridge-proxy](cmd/authbridge-proxy/) — proxy-sidecar binary (default mode, full plugin set)
482482
- [cmd/authbridge-envoy](cmd/authbridge-envoy/) — envoy-sidecar binary (Envoy + ext_proc, full plugin set)
483-
- `authbridge-lite` image — `cmd/authbridge-proxy` built with `exclude_plugin_*` tags (auth-only); a build variant, not a separate binary
483+
- `authbridge-lite` image — `cmd/authbridge-proxy` built with `exclude_plugin_*` tags from `authbridge/scripts/lite-tags` (trimmed plugin set); a build variant, not a separate binary
484484
- [proxy-init](proxy-init/README.md) — iptables init container (envoy-sidecar mode only)
485485
- [docs/](docs/) — framework architecture and plugin author references
486486

authbridge/cmd/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ inbound mechanism, and the preset fills only that one's address.
7575
iptables init container.
7676
- **Size-constrained, no protocol-aware events needed**: use the
7777
`authbridge-lite` image — the `authbridge-proxy` binary built with
78-
`exclude_plugin_*` tags (auth-only). Same listener layout, but without
79-
parsers/OPA — abctl will only see denial events and basic auth-level
80-
invocations, not full A2A/MCP/Inference protocol context.
78+
`exclude_plugin_*` tags from `authbridge/scripts/lite-tags` (trimmed
79+
plugin set). Same listener layout, but abctl will only see denial
80+
events and basic auth-level invocations for the plugins the trimmed
81+
set drops.

authbridge/demos/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ more AuthBridge capabilities.
66

77
> **Note:** These demos use the operator-injected combined sidecar (after
88
> cortex#411`authbridge` for proxy-sidecar, `authbridge-envoy`
9-
> for envoy-sidecar, and `authbridge-lite`, the proxy image built auth-only
10-
> via `exclude_plugin_*` tags). The previous `authbridge-unified` image and the per-component
9+
> for envoy-sidecar, and `authbridge-lite`, the proxy image built with a
10+
> trimmed plugin set via `exclude_plugin_*` tags from
11+
> `authbridge/scripts/lite-tags`). The previous `authbridge-unified` image and the per-component
1112
> sidecars (`client-registration`, standalone `spiffe-helper`) have been
1213
> removed.
1314

authbridge/go.work

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ use (
77
./cmd/authbridge-envoy
88
./cmd/authbridge-praxis
99
./cmd/authbridge-proxy
10+
./scripts/lite-tags
1011
./storage/redis
1112
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/rossoctl/cortex/authbridge/scripts/lite-tags
2+
3+
go 1.26.5

0 commit comments

Comments
 (0)