From 9d26fb8d32b20324f306b4f15ca83a5ead1c3688 Mon Sep 17 00:00:00 2001 From: Guillaume Galy Date: Thu, 19 Sep 2024 15:18:31 +0200 Subject: [PATCH] feat: distinguish API URL from web app URL --- src/main/scala/io/gatling/sbt/GatlingKeys.scala | 4 +++- .../gatling/sbt/settings/gatling/EnterprisePluginTask.scala | 5 +++-- .../gatling/sbt/settings/gatling/EnterpriseSettings.scala | 3 ++- .../gatling/sbt/settings/gatling/TaskEnterpriseStart.scala | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/scala/io/gatling/sbt/GatlingKeys.scala b/src/main/scala/io/gatling/sbt/GatlingKeys.scala index 9060790..6412a02 100644 --- a/src/main/scala/io/gatling/sbt/GatlingKeys.scala +++ b/src/main/scala/io/gatling/sbt/GatlingKeys.scala @@ -39,7 +39,9 @@ object GatlingKeys { private val documentationReference = "See https://docs.gatling.io/reference/integrations/build-tools/sbt-plugin/#running-your-simulations-on-gatling-enterprise-cloud for more information" - val enterpriseUrl = settingKey[URL]("URL of Gatling Enterprise.") + val enterpriseApiUrl = settingKey[URL]("URL of the Gatling Enterprise API.") + + val enterpriseWebAppUrl = settingKey[URL]("URL of the Gatling Enterprise web app.") val enterpriseApiToken = settingKey[String]( diff --git a/src/main/scala/io/gatling/sbt/settings/gatling/EnterprisePluginTask.scala b/src/main/scala/io/gatling/sbt/settings/gatling/EnterprisePluginTask.scala index 4ac1994..80cff37 100644 --- a/src/main/scala/io/gatling/sbt/settings/gatling/EnterprisePluginTask.scala +++ b/src/main/scala/io/gatling/sbt/settings/gatling/EnterprisePluginTask.scala @@ -38,7 +38,8 @@ object EnterprisePluginTask { private def pluginConfiguration(config: Configuration, requireBatchMode: Boolean): InitializeTask[PluginConfiguration] = Def.task { - val url = (config / enterpriseUrl).value + val apiUrl = (config / enterpriseApiUrl).value + val webAppUrl = (config / enterpriseWebAppUrl).value val apiToken = (config / enterpriseApiToken).value val privateControlPlaneUrl = (config / enterpriseControlPlaneUrl).value val pluginIO = enterprisePluginIOTask.value @@ -53,6 +54,6 @@ object EnterprisePluginTask { throw ErrorAlreadyLoggedException } - new PluginConfiguration(url, apiToken, privateControlPlaneUrl.orNull, BuildTool.SBT, BuildInfo.version, requireBatchMode, pluginIO) + new PluginConfiguration(apiUrl, webAppUrl, apiToken, privateControlPlaneUrl.orNull, BuildTool.SBT, BuildInfo.version, requireBatchMode, pluginIO) } } diff --git a/src/main/scala/io/gatling/sbt/settings/gatling/EnterpriseSettings.scala b/src/main/scala/io/gatling/sbt/settings/gatling/EnterpriseSettings.scala index 8dbcf04..e27a160 100644 --- a/src/main/scala/io/gatling/sbt/settings/gatling/EnterpriseSettings.scala +++ b/src/main/scala/io/gatling/sbt/settings/gatling/EnterpriseSettings.scala @@ -52,7 +52,8 @@ object EnterpriseSettings { val taskStart = new TaskEnterpriseStart(config, taskDeploy) Seq( - config / enterpriseUrl := new URI(ConfigurationConstants.Url.value()).toURL, + config / enterpriseApiUrl := new URI(ConfigurationConstants.ApiUrl.value()).toURL, + config / enterpriseWebAppUrl := new URI(ConfigurationConstants.WebAppUrl.value()).toURL, config / enterprisePackage := taskPackage.buildEnterprisePackage.value, config / enterpriseUpload := taskUpload.uploadEnterprisePackage.value, config / enterpriseDeploy := taskDeploy.enterpriseDeploy.evaluated, diff --git a/src/main/scala/io/gatling/sbt/settings/gatling/TaskEnterpriseStart.scala b/src/main/scala/io/gatling/sbt/settings/gatling/TaskEnterpriseStart.scala index 2c9ed41..721890a 100644 --- a/src/main/scala/io/gatling/sbt/settings/gatling/TaskEnterpriseStart.scala +++ b/src/main/scala/io/gatling/sbt/settings/gatling/TaskEnterpriseStart.scala @@ -98,16 +98,16 @@ class TaskEnterpriseStart(config: Configuration, taskEnterpriseDeploy: TaskEnter val runSummary = enterprisePlugin.startSimulation(commandArgs.simulationName.orNull, deploymentInfo, runComment) - logStartResult(logger, runSummary, waitForRunEndSetting, baseUrl = (config / enterpriseUrl).value) + logStartResult(logger, runSummary, waitForRunEndSetting, webAppUrl = (config / enterpriseWebAppUrl).value) maybeWaitForRunEnd(logger, enterprisePlugin, waitForRunEndSetting, runSummary) } } - private def logStartResult(logger: ManagedLogger, runSummary: RunSummary, waitForRunEndSetting: Boolean, baseUrl: sbt.URL): Unit = { + private def logStartResult(logger: ManagedLogger, runSummary: RunSummary, waitForRunEndSetting: Boolean, webAppUrl: sbt.URL): Unit = { logSimulationConfiguration(logger, waitForRunEndSetting) - val reportsUrl = baseUrl.toExternalForm + runSummary.reportsPath + val reportsUrl = webAppUrl.toExternalForm + runSummary.reportsPath logger.success(s"Simulation successfully started; reports available at $reportsUrl") }