File tree 4 files changed +30
-10
lines changed
scaletest/templates/scaletest-runner 4 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,16 @@ data "coder_parameter" "cleanup_strategy" {
169
169
}
170
170
}
171
171
172
+ data "coder_parameter" "cleanup_prepare" {
173
+ order = 14
174
+ type = " bool"
175
+ name = " Cleanup before scaletest"
176
+ default = true
177
+ description = " Cleanup existing scaletest users and workspaces before the scaletest starts (prepare phase)."
178
+ mutable = true
179
+ ephemeral = true
180
+ }
181
+
172
182
173
183
data "coder_parameter" "workspace_template" {
174
184
order = 20
@@ -563,6 +573,7 @@ resource "coder_agent" "main" {
563
573
SCALETEST_PARAM_NUM_WORKSPACES : data.coder_parameter.num_workspaces.value,
564
574
SCALETEST_PARAM_CREATE_CONCURRENCY : " ${ data . coder_parameter . create_concurrency . value } " ,
565
575
SCALETEST_PARAM_CLEANUP_STRATEGY : data.coder_parameter.cleanup_strategy.value,
576
+ SCALETEST_PARAM_CLEANUP_PREPARE : data.coder_parameter.cleanup_prepare.value ? " 1" : " 0" ,
566
577
SCALETEST_PARAM_LOAD_SCENARIOS : data.coder_parameter.load_scenarios.value,
567
578
SCALETEST_PARAM_LOAD_SCENARIO_RUN_CONCURRENTLY : data.coder_parameter.load_scenario_run_concurrently.value ? " 1" : " 0" ,
568
579
SCALETEST_PARAM_LOAD_SCENARIO_SSH_TRAFFIC_DURATION : " ${ data . coder_parameter . load_scenario_ssh_traffic_duration . value } " ,
Original file line number Diff line number Diff line change @@ -21,17 +21,20 @@ if [[ $event = manual ]]; then
21
21
fi
22
22
fi
23
23
24
- start_phase " Cleanup (${event} )"
25
- coder exp scaletest cleanup \
26
- --cleanup-job-timeout 2h \
27
- --cleanup-timeout 5h |
28
- tee " ${SCALETEST_RESULTS_DIR} /cleanup-${event} .txt"
29
- end_phase
24
+ if [[ $event != shutdown_scale_down_only ]]; then
25
+ start_phase " Cleanup (${event} )"
26
+ coder exp scaletest cleanup \
27
+ --cleanup-job-timeout 2h \
28
+ --cleanup-timeout 5h \
29
+ | tee " ${SCALETEST_RESULTS_DIR} /cleanup-${event} .txt"
30
+ end_phase
31
+ fi
30
32
31
33
if [[ $event != prepare ]]; then
32
- start_phase " Scaling down provisioners... "
34
+ start_phase " Scale down provisioners"
33
35
maybedryrun " $DRY_RUN " kubectl scale deployment/coder-provisioner --replicas 1
34
36
maybedryrun " $DRY_RUN " kubectl rollout status deployment/coder-provisioner
37
+ end_phase
35
38
fi
36
39
37
40
if [[ $event = manual ]]; then
Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ unset CODER_SESSION_TOKEN
47
47
echo -n " ${token} " > " ${CODER_CONFIG_DIR} /session"
48
48
[[ $VERBOSE == 1 ]] && set -x # Restore logging (if enabled).
49
49
50
- log " Cleaning up from previous runs (if applicable)..."
51
- " ${SCRIPTS_DIR} /cleanup.sh" " prepare"
50
+ if [[ ${SCALETEST_PARAM_CLEANUP_PREPARE} == 1 ]]; then
51
+ log " Cleaning up from previous runs (if applicable)..."
52
+ " ${SCRIPTS_DIR} /cleanup.sh" prepare
53
+ fi
52
54
53
55
log " Preparation complete!"
54
56
Original file line number Diff line number Diff line change @@ -14,7 +14,11 @@ trap cleanup EXIT
14
14
15
15
annotate_grafana " workspace" " Agent stopping..."
16
16
17
- " ${SCRIPTS_DIR} /cleanup.sh" shutdown
17
+ shutdown_event=shutdown_scale_down_only
18
+ if [[ ${SCALETEST_PARAM_CLEANUP_STRATEGY} == on_stop ]]; then
19
+ shutdown_event=shutdown
20
+ fi
21
+ " ${SCRIPTS_DIR} /cleanup.sh" " ${shutdown_event} "
18
22
19
23
annotate_grafana_end " workspace" " Agent running"
20
24
You can’t perform that action at this time.
0 commit comments