Skip to content

Commit

Permalink
feat: distinguish API URL from web app URL
Browse files Browse the repository at this point in the history
  • Loading branch information
guilgaly authored and notdryft committed Sep 20, 2024
1 parent c815c8a commit a8ce4f9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/main/scala/io/gatling/sbt/GatlingKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit a8ce4f9

Please sign in to comment.