You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -455,6 +455,20 @@ The above simulates 5 concurrent rooms, where each room has:
455
455
456
456
Once the specified duration is over (or if the load test is manually stopped), the load test statistics will be displayed in the form of a table.
457
457
458
+
## Agent simulations in CI
459
+
460
+
Use a finished simulation run as a baseline so known failures are reported without failing CI, while regressions still return a nonzero exit code:
461
+
462
+
```shell
463
+
lk agent simulate \
464
+
--scenarios scenarios.yaml \
465
+
--baseline "$SIMULATION_BASELINE_RUN_ID" \
466
+
--run-id-file "$RUNNER_TEMP/simulation-run-id"
467
+
```
468
+
469
+
The CLI writes the new run ID to `--run-id-file` as soon as the run is created, even if the simulation later fails. Store the ID in your CI provider's variable or artifact store. Only a successful run on the main branch should replace the stored baseline; pull requests and failed main runs should leave it unchanged.
470
+
471
+
For the first run, omit `--baseline`, inspect and accept its results, then store the ID written to the file. A missing, unfinished, or inaccessible baseline fails CI rather than silently using strict comparison.
Copy file name to clipboardExpand all lines: cmd/lk/simulate.go
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,10 @@ var simulateCommand = &cli.Command{
105
105
Name: "baseline",
106
106
Usage: "Compare failures against the finished run with run `ID`: only scenarios that pass there and fail here fail the exit code. Non-interactive (CI) runs only",
107
107
},
108
+
&cli.StringFlag{
109
+
Name: "run-id-file",
110
+
Usage: "Write the simulation run ID to `FILE` as soon as it is available. Non-interactive (CI) runs only",
111
+
},
108
112
&cli.StringFlag{
109
113
Name: "agent-name",
110
114
Usage: "Run against an already-running agent instead of spawning one locally. Pass the registered `NAME`, or \"\" to target the project's default agent (the one that auto-joins every room). Requires --scenarios.",
@@ -219,6 +223,7 @@ type simulateConfig struct {
219
223
scenariosPathstring// path to the --scenarios file (empty when generating from source)
220
224
viewModeRunIDstring// non-empty when --view opens a pre-existing run
221
225
baselineRunIDstring// --baseline: failures this run also has don't fail CI
226
+
runIDFilestring// --run-id-file: machine-readable handoff to CI
222
227
liveAgentbool// --agent-name: run against an already-running agent, don't spawn one
223
228
warnings []string// config-level warnings surfaced at setup (e.g. ignored flags)
0 commit comments