feat(scaletest/templates): add comment parameter (#10285)

This commit is contained in:
Mathias Fredriksson 2023-10-16 16:28:23 +03:00 committed by GitHub
parent 6875faf238
commit 3c49290dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View File

@ -84,6 +84,16 @@ data "coder_parameter" "repo_branch" {
mutable = true
}
data "coder_parameter" "comment" {
order = 4
type = "string"
name = "Comment"
default = ""
description = "Describe **what** you're testing and **why** you're testing it."
mutable = true
ephemeral = true
}
data "coder_parameter" "create_concurrency" {
order = 10
type = "number"
@ -365,6 +375,10 @@ resource "coder_agent" "main" {
SCALETEST_RUN_ID : local.scaletest_run_id,
SCALETEST_RUN_DIR : local.scaletest_run_dir,
# Comment is a scaletest param, but we want to surface it separately from
# the rest, so we use a different name.
SCALETEST_COMMENT : data.coder_parameter.comment.value != "" ? data.coder_parameter.comment.value : "No comment provided",
SCALETEST_PARAM_TEMPLATE : data.coder_parameter.workspace_template.value,
SCALETEST_PARAM_REPO_BRANCH : data.coder_parameter.repo_branch.value,
SCALETEST_PARAM_NUM_WORKSPACES : data.coder_parameter.num_workspaces.value,

View File

@ -80,6 +80,7 @@ esac
text_arr=(
"${header}"
""
"${bullet} *Comment:* ${SCALETEST_COMMENT}"
"${bullet} Workspace (runner): ${CODER_URL}/@${owner_name}/${workspace_name}"
"${bullet} Run ID: ${SCALETEST_RUN_ID}"
"${app_urls[@]}"

View File

@ -18,6 +18,9 @@ if [[ ! -d "${HOME}/coder" ]]; then
fi
(cd "${HOME}/coder" && git fetch -a && git checkout "${SCALETEST_PARAM_REPO_BRANCH}" && git pull)
# Store the input parameters (for debugging).
env | grep "^SCALETEST_" | sort >"${SCALETEST_RUN_DIR}/environ.txt"
# shellcheck disable=SC2153 source=scaletest/templates/scaletest-runner/scripts/lib.sh
. "${SCRIPTS_DIR}/lib.sh"
@ -101,7 +104,7 @@ on_exit() {
set_appearance "${appearance_json}" "${message_color}" "${service_banner_message} | Scaletest ${message_status}: [${CODER_USER}/${CODER_WORKSPACE}](${CODER_URL}/@${CODER_USER}/${CODER_WORKSPACE})!"
annotate_grafana_end "" "Start scaletest"
annotate_grafana_end "" "Start scaletest: ${SCALETEST_COMMENT}"
}
trap on_exit EXIT
@ -121,7 +124,7 @@ trap on_err ERR
# Pass session token since `prepare.sh` has not yet run.
CODER_SESSION_TOKEN=$CODER_USER_TOKEN "${SCRIPTS_DIR}/report.sh" started
annotate_grafana "" "Start scaletest"
annotate_grafana "" "Start scaletest: ${SCALETEST_COMMENT}"
"${SCRIPTS_DIR}/prepare.sh"