Skip to content

Commit 3c49290

Browse files
authored
feat(scaletest/templates): add comment parameter (coder#10285)
1 parent 6875faf commit 3c49290

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

scaletest/templates/scaletest-runner/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ data "coder_parameter" "repo_branch" {
8484
mutable = true
8585
}
8686

87+
data "coder_parameter" "comment" {
88+
order = 4
89+
type = "string"
90+
name = "Comment"
91+
default = ""
92+
description = "Describe **what** you're testing and **why** you're testing it."
93+
mutable = true
94+
ephemeral = true
95+
}
96+
8797
data "coder_parameter" "create_concurrency" {
8898
order = 10
8999
type = "number"
@@ -365,6 +375,10 @@ resource "coder_agent" "main" {
365375
SCALETEST_RUN_ID : local.scaletest_run_id,
366376
SCALETEST_RUN_DIR : local.scaletest_run_dir,
367377

378+
# Comment is a scaletest param, but we want to surface it separately from
379+
# the rest, so we use a different name.
380+
SCALETEST_COMMENT : data.coder_parameter.comment.value != "" ? data.coder_parameter.comment.value : "No comment provided",
381+
368382
SCALETEST_PARAM_TEMPLATE : data.coder_parameter.workspace_template.value,
369383
SCALETEST_PARAM_REPO_BRANCH : data.coder_parameter.repo_branch.value,
370384
SCALETEST_PARAM_NUM_WORKSPACES : data.coder_parameter.num_workspaces.value,

scaletest/templates/scaletest-runner/scripts/report.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ esac
8080
text_arr=(
8181
"${header}"
8282
""
83+
"${bullet} *Comment:* ${SCALETEST_COMMENT}"
8384
"${bullet} Workspace (runner): ${CODER_URL}/@${owner_name}/${workspace_name}"
8485
"${bullet} Run ID: ${SCALETEST_RUN_ID}"
8586
"${app_urls[@]}"

scaletest/templates/scaletest-runner/startup.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ if [[ ! -d "${HOME}/coder" ]]; then
1818
fi
1919
(cd "${HOME}/coder" && git fetch -a && git checkout "${SCALETEST_PARAM_REPO_BRANCH}" && git pull)
2020

21+
# Store the input parameters (for debugging).
22+
env | grep "^SCALETEST_" | sort >"${SCALETEST_RUN_DIR}/environ.txt"
23+
2124
# shellcheck disable=SC2153 source=scaletest/templates/scaletest-runner/scripts/lib.sh
2225
. "${SCRIPTS_DIR}/lib.sh"
2326

@@ -101,7 +104,7 @@ on_exit() {
101104

102105
set_appearance "${appearance_json}" "${message_color}" "${service_banner_message} | Scaletest ${message_status}: [${CODER_USER}/${CODER_WORKSPACE}](${CODER_URL}/@${CODER_USER}/${CODER_WORKSPACE})!"
103106

104-
annotate_grafana_end "" "Start scaletest"
107+
annotate_grafana_end "" "Start scaletest: ${SCALETEST_COMMENT}"
105108
}
106109
trap on_exit EXIT
107110

@@ -121,7 +124,7 @@ trap on_err ERR
121124

122125
# Pass session token since `prepare.sh` has not yet run.
123126
CODER_SESSION_TOKEN=$CODER_USER_TOKEN "${SCRIPTS_DIR}/report.sh" started
124-
annotate_grafana "" "Start scaletest"
127+
annotate_grafana "" "Start scaletest: ${SCALETEST_COMMENT}"
125128

126129
"${SCRIPTS_DIR}/prepare.sh"
127130

0 commit comments

Comments
 (0)