agentgateway/tools/proxy-dev-build
Nina Polshakova 0f71c997a4
Fix e2e test setup on mac (#1117)
To test e2e tests locally on a mac you can run the setup with:
```
TEST_MODE=e2e ./controller/test/setup/setup-kind-ci.sh
```

Then run the tests with:
```
 USE_PORTFORWARD=true PERSIST_INSTALL=true CGO_ENABLED=0 go test -vet=off -ldflags='-s -w' --failfast -tags=e2e -v ./controller/test/e2e/tests -run 'TestAgentgatewayIntegration'
```
(Where the regex can select a specific test or run the full suite)

```
--- PASS: TestAgentgatewayIntegration (49.60s)
    --- PASS: TestAgentgatewayIntegration/LocalRateLimit (0.24s)
        --- SKIP: TestAgentgatewayIntegration/LocalRateLimit/TestLocalRateLimitDisabledForRoute (0.00s)
        --- PASS: TestAgentgatewayIntegration/LocalRateLimit/TestLocalRateLimitForGateway (0.05s)
        --- PASS: TestAgentgatewayIntegration/LocalRateLimit/TestLocalRateLimitForRoute (0.07s)
        --- SKIP: TestAgentgatewayIntegration/LocalRateLimit/TestLocalRateLimitForRouteUsingExtensionRef (0.00s)
    --- PASS: TestAgentgatewayIntegration/RBAC (0.13s)
        --- PASS: TestAgentgatewayIntegration/RBAC/TestRBACHeaderAuthorization (0.03s)
    --- PASS: TestAgentgatewayIntegration/MCP (12.19s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestDynamicMCPAdminRouting (0.43s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestDynamicMCPAdminVsUserTools (0.37s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestDynamicMCPDefaultRouting (0.18s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestDynamicMCPUserRouting (0.20s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestMCPAuthn (3.01s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestMCPWorkflow (0.21s)
        --- PASS: TestAgentgatewayIntegration/MCP/TestSSEEndpoint (0.09s)
    --- PASS: TestAgentgatewayIntegration/AIBackend (1.20s)
        --- PASS: TestAgentgatewayIntegration/AIBackend/TestPromptGuard (0.02s)
        --- PASS: TestAgentgatewayIntegration/AIBackend/TestRouting (0.01s)
        --- SKIP: TestAgentgatewayIntegration/AIBackend/TestWebhook (0.00s)
    --- PASS: TestAgentgatewayIntegration/PolicyStatus (0.17s)
        --- PASS: TestAgentgatewayIntegration/PolicyStatus/TestAgwPolicyClearStaleStatus (0.09s)
    --- PASS: TestAgentgatewayIntegration/A2A (1.18s)
        --- PASS: TestAgentgatewayIntegration/A2A/TestA2AAgentCard (0.03s)
        --- PASS: TestAgentgatewayIntegration/A2A/TestA2AHelloWorld (0.03s)
        --- PASS: TestAgentgatewayIntegration/A2A/TestA2AMessageSend (0.01s)
    --- PASS: TestAgentgatewayIntegration/BasicRouting (0.13s)
        --- PASS: TestAgentgatewayIntegration/BasicRouting/TestAgentgatewayHTTPRoute (0.04s)
        --- PASS: TestAgentgatewayIntegration/BasicRouting/TestAgentgatewayTCPRoute (0.02s)
    --- PASS: TestAgentgatewayIntegration/BackendTLSPolicy (0.34s)
        --- PASS: TestAgentgatewayIntegration/BackendTLSPolicy/TestBackendTLSPolicyAndStatus (0.20s)
    --- PASS: TestAgentgatewayIntegration/BasicAuth (0.22s)
        --- PASS: TestAgentgatewayIntegration/BasicAuth/TestGatewayPolicy (0.05s)
        --- PASS: TestAgentgatewayIntegration/BasicAuth/TestRoutePolicy (0.08s)
    --- PASS: TestAgentgatewayIntegration/JwtAuth (0.27s)
        --- PASS: TestAgentgatewayIntegration/JwtAuth/TestGatewayPolicy (0.05s)
        --- PASS: TestAgentgatewayIntegration/JwtAuth/TestGatewayPolicyWithRbac (0.04s)
        --- PASS: TestAgentgatewayIntegration/JwtAuth/TestRoutePolicy (0.06s)
        --- PASS: TestAgentgatewayIntegration/JwtAuth/TestRoutePolicyWithRbac (0.04s)
    --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth (8.89s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestGatewayPolicyBackend (0.40s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestGatewayPolicyBackendWithTlsPolicy (0.92s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestGatewayPolicySvc (0.04s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestGatewayPolicySvcCaCert (1.06s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestGatewayPolicyWithRbac (0.88s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestRoutePolicyBackend (1.08s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestRoutePolicyBackendAndTlsPolicy (0.04s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestRoutePolicySvc (0.90s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestRoutePolicySvcCaCert (1.06s)
        --- PASS: TestAgentgatewayIntegration/RemoteJwtAuth/TestRoutePolicyWithRbac (0.89s)
    --- PASS: TestAgentgatewayIntegration/Tracing (16.41s)
        --- PASS: TestAgentgatewayIntegration/Tracing/TestOTelTracing (15.29s)
    --- PASS: TestAgentgatewayIntegration/ApiKeyAuth (0.21s)
        --- PASS: TestAgentgatewayIntegration/ApiKeyAuth/TestGatewayPolicy (0.06s)
        --- PASS: TestAgentgatewayIntegration/ApiKeyAuth/TestRoutePolicy (0.08s)
    --- PASS: TestAgentgatewayIntegration/Extauth (1.26s)
        --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicy (0.05s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicy/request_allowed_with_allow_header (0.02s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicy/request_denied_without_allow_header (0.00s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicy/request_denied_with_deny_header (0.00s)
        --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicyMissingBackendRef (0.04s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestExtAuthPolicyMissingBackendRef/request_denied_for_invalid_extauth_policy_due_to_missing_backendRef (0.02s)
        --- PASS: TestAgentgatewayIntegration/Extauth/TestRouteTargetedExtAuthPolicy (0.05s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestRouteTargetedExtAuthPolicy/request_allowed_by_default (0.00s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestRouteTargetedExtAuthPolicy/request_allowed_with_allow_header_on_secured_route (0.02s)
            --- PASS: TestAgentgatewayIntegration/Extauth/TestRouteTargetedExtAuthPolicy/request_denied_without_header_on_secured_route (0.01s)
    --- PASS: TestAgentgatewayIntegration/GlobalRateLimit (4.42s)
        --- PASS: TestAgentgatewayIntegration/GlobalRateLimit/TestCombinedLocalAndGlobalRateLimit (0.07s)
        --- PASS: TestAgentgatewayIntegration/GlobalRateLimit/TestGlobalRateLimitByPath (0.07s)
        --- PASS: TestAgentgatewayIntegration/GlobalRateLimit/TestGlobalRateLimitByRemoteAddress (0.06s)
        --- PASS: TestAgentgatewayIntegration/GlobalRateLimit/TestGlobalRateLimitByUserID (0.04s)
    --- PASS: TestAgentgatewayIntegration/Transformation (0.19s)
        --- PASS: TestAgentgatewayIntegration/Transformation/TestGatewayWithTransformedGRPCRoute (0.06s)
        --- PASS: TestAgentgatewayIntegration/Transformation/TestGatewayWithTransformedHTTPRoute (0.05s)
    --- PASS: TestAgentgatewayIntegration/CSRF (0.13s)
        --- PASS: TestAgentgatewayIntegration/CSRF/TestGatewayLevelCSRF (0.06s)
    --- PASS: TestAgentgatewayIntegration/Extproc (1.71s)
        --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithGatewayTargetRef (0.06s)
            --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithGatewayTargetRef/first_route_should_have_ExtProc_applied_via_Gateway_policy (0.01s)
            --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithGatewayTargetRef/second_route_also_has_ExtProc_applied_via_Gateway_policy (0.00s)
        --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithHTTPRouteTargetRef (0.03s)
            --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithHTTPRouteTargetRef/route_with_ExtProc_applied_should_have_header_modified (0.00s)
            --- PASS: TestAgentgatewayIntegration/Extproc/TestExtProcWithHTTPRouteTargetRef/route_without_ExtProc_should_not_have_header_modified (0.00s)
PASS
ok      github.com/agentgateway/agentgateway/controller/test/e2e/tests  50.401s

```

Changes made:
- `USE_PORTFORWARD` will run the tests with the gateway port-forwarded,
removing the dependency of having to set up the cloud provider kind
workaround https://github.com/kubernetes-sigs/cloud-provider-kind
- Small fixes to makefile to reflect new agentgateway repo paths 
- Fixes setup script to work with mac commands (`wait` fix for sibling
pids, fix proxy build)
- Introduce `docker-ci` to have a fast version of building locally

---------

Signed-off-by: npolshakova <nina.polshakova@solo.io>
2026-03-04 12:47:34 -05:00

43 lines
917 B
Bash
Executable File

#!/bin/bash
set -e
get-tag () {
if [[ -n "${TAG:-""}" ]]
then
echo ${TAG}
else
echo `date +%s`
fi
}
profile="${1:-dev}"
platform="${2:-}"
tgt="${profile}"
if [[ $tgt == "dev" ]]; then
tgt=debug
fi
if [[ "$(uname -s)" != "Linux" ]]; then
echo "Error: proxy-dev-build only supports Linux. Use 'make docker-ci' on Mac." >&2
exit 1
fi
cargo build --profile "${profile}" ${platform:+--target $platform} ${TIMINGS+--timings} || exit 1
if [[ -n "${DRY_RUN:-}" ]]; then
exit 0
fi
tag="$(get-tag)"
dest="localhost:5000/agentgateway:${tag}"
{
crane mutate --platform linux/amd64 $(
crane append --platform linux/amd64 \
-f <(tar -f - -c --transform "s|./target/${platform:+$platform/}${tgt}/|/usr/bin/|" ./target/${platform:+$platform/}${tgt}/agentgateway) \
-t ${dest} \
-b istio/base
) --entrypoint /usr/bin/agentgateway -t ${dest} 1>&2
}
echo ${tag}
echo ${dest} 1>&2