Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scaletest/templates/scaletest-runner/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions scaletest/templates/scaletest-runner/scripts/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
7 changes: 5 additions & 2 deletions scaletest/templates/scaletest-runner/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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

Expand All @@ -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"

Expand Down