Skip to content

Commit e3b4b05

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 0b3b3a3 + e0016fa commit e3b4b05

15 files changed

Lines changed: 164 additions & 39 deletions

File tree

‎.github/actions/build-rust-binary/action.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ inputs:
3636
runs:
3737
using: composite
3838
steps:
39+
# Per-binary caches are large and other branches can restore main's, so
40+
# saving them elsewhere mostly evicts main's from the shared quota.
3941
- uses: ./.github/actions/setup-rust
4042
with:
4143
cache-key: binaries-v2-${{ inputs.binary }}-${{ inputs.triple }}
42-
save-cache: "true"
44+
save-cache: ${{ github.ref == 'refs/heads/main' }}
4345

4446
- name: Set version
4547
shell: nix develop -c bash -euo pipefail {0}

‎.github/actions/setup-rust/action.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ inputs:
1313
required: false
1414
default: "false"
1515

16+
outputs:
17+
cache-hit:
18+
description: "true when the cache key matched exactly"
19+
value: ${{ steps.cache.outputs.cache-hit }}
20+
1621
runs:
1722
using: composite
1823
steps:
@@ -24,6 +29,7 @@ runs:
2429
echo "hash=$(nix hash file --type sha256 --base16 "$shell_drv")" >> "$GITHUB_OUTPUT"
2530
2631
- name: Cache Rust target and registry
32+
id: cache
2733
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
2834
with:
2935
shared-key: ${{ inputs.cache-key }}-${{ steps.dev-shell.outputs.hash }}

‎.github/workflows/rust-cache.yml‎

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Rust Cache
5+
6+
# Branch Checks never runs on main, so this saves the rust-checks cache that PR
7+
# mirrors and merge groups restore. Keep env and build commands aligned with
8+
# the Branch Checks rust-test job so the cache keys and contents match.
9+
on:
10+
push:
11+
branches:
12+
- main
13+
workflow_dispatch:
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
CARGO_INCREMENTAL: "0"
18+
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
permissions:
21+
contents: read
22+
packages: read
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
# Let runs finish so frequent merges cannot keep cancelling the save.
27+
cancel-in-progress: false
28+
29+
jobs:
30+
rust-checks:
31+
name: Rust checks cache (${{ matrix.system }})
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- runner: linux-amd64-cpu8
37+
system: x86_64-linux
38+
- runner: linux-arm64-cpu8
39+
system: aarch64-linux
40+
- runner: macos-15-xlarge
41+
system: aarch64-darwin
42+
runs-on: ${{ matrix.runner }}
43+
timeout-minutes: 45
44+
steps:
45+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46+
with:
47+
persist-credentials: false
48+
49+
- uses: ./.github/actions/setup-nix
50+
with:
51+
prepare-shell: "true"
52+
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
53+
54+
- id: rust
55+
uses: ./.github/actions/setup-rust
56+
with:
57+
cache-key: rust-checks-v2
58+
save-cache: "true"
59+
60+
- name: Build tests
61+
if: steps.rust.outputs.cache-hit != 'true'
62+
shell: nix develop -c bash -euo pipefail {0}
63+
run: |
64+
cargo test --locked -p openshell-crypto --no-default-features --test independent_backend --no-run
65+
cargo nextest run --locked --profile ci --workspace --features openshell-server/test-support --no-run
66+
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path examples/supervisor-middleware-content-guard/Cargo.toml --no-run
67+
cargo nextest run --locked --config-file .config/nextest.toml --profile ci --manifest-path tests/testkit/Cargo.toml --no-run

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Follow `CONTRIBUTING.md` and `create-github-pr`. Authors without target-reposito
186186
- Format: `<type>(<scope>): <description>` (scope is optional)
187187
- Common types: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `ci`, `perf`
188188
- Sign off on each commit for DCO compliance. Use the `--signoff` option to `git commit` to add the `Signed-off-by` footer to ensure the user's configured email address is used.
189-
- Never mention Claude or any AI agent in commits (no author attribution, no Co-Authored-By, no references in commit messages)
189+
- Never mention Claude or any AI agent in commits, PR descriptions, or issues (no author attribution, no Co-Authored-By, no "Generated with" footers)
190190

191191
## Go SDK (`sdk/go/`)
192192

‎CI.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,8 @@ The bot's full administrator documentation is internal to NVIDIA. The only comma
618618
| `.github/actions/setup-e2e-*` | Shared artifact, Podman, KVM, and kind setup used by the runtime lanes. |
619619
| `.github/workflows/helm-lint.yml` | Helm chart validation. PR mirror pushes skip lint jobs unless Helm inputs changed; merge groups always validate Helm because they represent the final integration state. |
620620
| `.github/actions/setup-nix/action.yml` | Installs Nix and configures the OpenShell Cachix cache, using read-only cache access when no authentication token is available. |
621+
| `.github/actions/setup-rust/action.yml` | Restores the Rust target and registry cache. Other branches can restore only their own caches and `main`'s, so per-binary release build caches are saved only on `main`. |
622+
| `.github/workflows/rust-cache.yml` | Builds the Branch Checks test targets on each push to `main` to save the `rust-checks` cache that PR mirrors and merge groups restore. Skips the build when the cache already matches. |
621623
| `.github/actions/pr-gate/action.yml` | Composite action that resolves PR metadata and verifies the required label is set for PR mirror pushes. Non-push events are allowed through. |
622624
| `.github/actions/pr-merge-base/action.yml` | Composite action that resolves and fetches the merge-base commit for `pull-request/<N>` push workflows. |
623625
| `.github/workflows/required-ci-gates.yml` | Posts required PR-head and merge-group statuses for gated CI workflows. This is what branch protection and merge queue should require. |

‎deploy/helm/openshell/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ discovery endpoint or its TLS CA.
527527
| server.enableUserNamespaces | bool | `false` | Enable Kubernetes user namespace isolation (hostUsers: false) for sandbox pods. Requires Kubernetes 1.33+ with user namespace support available (beta through 1.35, GA in 1.36+), plus a supporting container runtime and Linux 5.12+. When enabled, container UID 0 maps to an unprivileged host UID and capabilities become namespaced. |
528528
| server.enableWebsocketTunnel | bool | `false` | Enable the WebSocket tunnel used by CLI/SDK clients behind an authenticated edge proxy. Leave disabled for direct gateway installs. |
529529
| server.externalDbSecret | string | `""` | Name of a pre-existing Opaque Secret containing a PostgreSQL connection URI (key: uri). When set, the gateway reads OPENSHELL_DB_URL from this Secret instead of using dbUrl. The Secret must contain a `uri` key, e.g. postgresql://user:pass@host:5432/dbname. |
530+
| server.extraEnv | list | `[]` | Additional environment variables for the gateway container, such as OTEL_* exporter settings. Entries can read from a Secret with valueFrom. |
530531
| server.extraVolumeMounts | list | `[]` | Additional volume mounts for the gateway container. |
531532
| server.extraVolumes | list | `[]` | Additional volumes for the gateway pod. |
532533
| server.grpcEndpoint | string | `""` | gRPC endpoint sandboxes call back into the gateway. Leave empty to derive it from the chart fullname, release namespace, service port, and disableTls flag, for example https://openshell.openshell.svc.cluster.local:8080. Override only when sandboxes must reach the gateway via a different hostname (e.g. an external ingress or a host alias). |

‎deploy/helm/openshell/templates/_gateway-workload.tpl‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ spec:
140140
- name: OPENSHELL_GATEWAY_SPIFFE_WORKLOAD_API_SOCKET
141141
value: {{ $spiffeSocketPath | quote }}
142142
{{- end }}
143+
{{- with .Values.server.extraEnv }}
144+
{{- toYaml . | nindent 8 }}
145+
{{- end }}
143146
volumeMounts:
144147
{{- if eq (include "openshell.workloadKind" .) "statefulset" }}
145148
- name: openshell-data

‎deploy/helm/openshell/tests/gateway_config_test.yaml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,47 @@ tests:
508508
mountPath: /var/log/openshell
509509
subPathExpr: $(OPENSHELL_POD_NAME)
510510

511+
- it: adds extra gateway environment variables in a StatefulSet
512+
template: templates/statefulset.yaml
513+
set:
514+
server.extraEnv:
515+
- name: OTEL_TRACES_SAMPLER
516+
value: parentbased_traceidratio
517+
- name: OTEL_EXPORTER_OTLP_HEADERS
518+
valueFrom:
519+
secretKeyRef:
520+
name: otel-collector-auth
521+
key: headers
522+
asserts:
523+
- contains:
524+
path: spec.template.spec.containers[0].env
525+
content:
526+
name: OTEL_TRACES_SAMPLER
527+
value: parentbased_traceidratio
528+
- contains:
529+
path: spec.template.spec.containers[0].env
530+
content:
531+
name: OTEL_EXPORTER_OTLP_HEADERS
532+
valueFrom:
533+
secretKeyRef:
534+
name: otel-collector-auth
535+
key: headers
536+
537+
- it: adds extra gateway environment variables in a Deployment
538+
template: templates/deployment.yaml
539+
set:
540+
workload.kind: deployment
541+
server.externalDbSecret: my-pg-secret
542+
server.extraEnv:
543+
- name: OTEL_TRACES_SAMPLER
544+
value: parentbased_traceidratio
545+
asserts:
546+
- contains:
547+
path: spec.template.spec.containers[0].env
548+
content:
549+
name: OTEL_TRACES_SAMPLER
550+
value: parentbased_traceidratio
551+
511552
- it: mounts the OIDC CA bundle when TLS is disabled
512553
template: templates/statefulset.yaml
513554
set:

‎deploy/helm/openshell/values.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ server:
369369
extraVolumes: []
370370
# -- Additional volume mounts for the gateway container.
371371
extraVolumeMounts: []
372+
# -- Additional environment variables for the gateway container, such as
373+
# OTEL_* exporter settings. Entries can read from a Secret with valueFrom.
374+
extraEnv: []
372375
# -- Enable anonymous OpenShell telemetry from the gateway and the sandbox
373376
# supervisors it launches.
374377
telemetryEnabled: true

‎docs/how-it-works/gateways/configuration.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,18 @@ The gateway honors these variables:
506506
| `OTEL_EXPORTER_OTLP_LOGS_HEADERS`, `OTEL_EXPORTER_OTLP_LOGS_COMPRESSION`, `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` | Exporter transport tuning for OCSF log records only. These override the general variables. |
507507
| `SSL_CERT_FILE`, `SSL_CERT_DIR` | Additional trust roots for `https://` endpoints, such as a private CA. |
508508

509+
For Helm deployments, set these variables with `server.extraEnv`. Read credentials from a Secret so they stay out of the values file:
510+
511+
```yaml
512+
server:
513+
extraEnv:
514+
- name: OTEL_EXPORTER_OTLP_HEADERS
515+
valueFrom:
516+
secretKeyRef:
517+
name: otel-collector-auth
518+
key: headers
519+
```
520+
509521
These variables have no effect. Only `[openshell.gateway.otlp]` decides which signals are exported and where they go, for two reasons:
510522

511523
- OCSF events are security records, so where they go must be a deliberate choice. Platform tooling can add `OTEL_*` variables to a process, as the OpenTelemetry Operator does for annotated pods on Kubernetes. Such a variable must not start sending security records to a collector, redirect them, or turn them off.

0 commit comments

Comments
 (0)