From f4fedc5a981b904b3979b703ee2b3c9048a8566a Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 16 Oct 2023 10:04:14 +0000 Subject: [PATCH 1/2] feat(scaletest/templates): add repo branch parameter --- scaletest/templates/scaletest-runner/main.tf | 10 ++++++++++ scaletest/templates/scaletest-runner/startup.sh | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scaletest/templates/scaletest-runner/main.tf b/scaletest/templates/scaletest-runner/main.tf index f96e144a8a34d..402820c2770ea 100644 --- a/scaletest/templates/scaletest-runner/main.tf +++ b/scaletest/templates/scaletest-runner/main.tf @@ -75,6 +75,15 @@ data "coder_parameter" "dry_run" { ephemeral = true } +data "coder_parameter" "repo_branch" { + order = 3 + type = "string" + name = "Branch" + default = "main" + description = "Branch of coder/coder repo to check out." + mutable = true +} + data "coder_parameter" "create_concurrency" { order = 10 type = "number" @@ -357,6 +366,7 @@ resource "coder_agent" "main" { SCALETEST_RUN_DIR : local.scaletest_run_dir, 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, SCALETEST_PARAM_CREATE_CONCURRENCY : "${data.coder_parameter.create_concurrency.value}", SCALETEST_PARAM_CLEANUP_STRATEGY : data.coder_parameter.cleanup_strategy.value, diff --git a/scaletest/templates/scaletest-runner/startup.sh b/scaletest/templates/scaletest-runner/startup.sh index 300ff40466b6f..7d0ef2d593f18 100755 --- a/scaletest/templates/scaletest-runner/startup.sh +++ b/scaletest/templates/scaletest-runner/startup.sh @@ -16,7 +16,7 @@ echo "Cloning coder/coder repo..." if [[ ! -d "${HOME}/coder" ]]; then git clone https://github.com/coder/coder.git "${HOME}/coder" fi -(cd "${HOME}/coder" && git pull) +(cd "${HOME}/coder" && git fetch -a && git checkout "${SCALETEST_PARAM_REPO_BRANCH}" && git pull) # shellcheck disable=SC2153 source=scaletest/templates/scaletest-runner/scripts/lib.sh . "${SCRIPTS_DIR}/lib.sh" From 045bbebb459e508a0264dc8432f9a48a8b3edef6 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Mon, 16 Oct 2023 11:43:05 +0000 Subject: [PATCH 2/2] update repo_branch description to better signify its purpose --- scaletest/templates/scaletest-runner/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaletest/templates/scaletest-runner/main.tf b/scaletest/templates/scaletest-runner/main.tf index 402820c2770ea..ca9d8b7b6bfb0 100644 --- a/scaletest/templates/scaletest-runner/main.tf +++ b/scaletest/templates/scaletest-runner/main.tf @@ -80,7 +80,7 @@ data "coder_parameter" "repo_branch" { type = "string" name = "Branch" default = "main" - description = "Branch of coder/coder repo to check out." + description = "Branch of coder/coder repo to check out (only useful for developing the runner)." mutable = true }