File tree Expand file tree Collapse file tree 4 files changed +58
-1
lines changed
src/main/groovy/io/gatling/gradle Expand file tree Collapse file tree 4 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ repositories {
22
22
}
23
23
24
24
dependencies {
25
- implementation " io.gatling:gatling-enterprise-plugin-commons:1.17.0 "
25
+ implementation " io.gatling:gatling-enterprise-plugin-commons:1.16.3 "
26
26
implementation " io.gatling:gatling-shared-cli:0.0.6"
27
27
28
28
testImplementation(' org.spockframework:spock-core:2.3-groovy-3.0' ) {
Original file line number Diff line number Diff line change
1
+ package io.gatling.gradle
2
+
3
+ import io.gatling.plugin.BatchEnterprisePlugin
4
+ import io.gatling.plugin.ConfigurationConstants
5
+ import org.gradle.api.DefaultTask
6
+ import org.gradle.api.InvalidUserDataException
7
+ import org.gradle.api.tasks.CacheableTask
8
+ import org.gradle.api.tasks.TaskAction
9
+
10
+ @CacheableTask
11
+ class GatlingEnterpriseUploadTask extends DefaultTask {
12
+
13
+ @TaskAction
14
+ void publish () {
15
+ def gatling = project. extensions. getByType(GatlingPluginExtension )
16
+ RecoverEnterprisePluginException . handle(logger) {
17
+ BatchEnterprisePlugin enterprisePlugin = gatling. enterprise. initBatchEnterprisePlugin(logger)
18
+ UUID packageUUID = gatling. enterprise. packageId
19
+
20
+ if (packageUUID) {
21
+ logger. lifecycle(" Uploading package with packageId " + packageUUID)
22
+ enterprisePlugin. uploadPackage(packageUUID, inputs. files. singleFile)
23
+ } else if (gatling. enterprise. simulationId) {
24
+ logger. lifecycle(" Uploading package belonging to the simulation " + gatling. enterprise. simulationId)
25
+ enterprisePlugin. uploadPackageWithSimulationId(gatling. enterprise. simulationId, inputs. files. singleFile)
26
+ } else {
27
+ throw new InvalidUserDataException (" You need to either configure gatling.enterprise.packageId (or pass it with '-D${ ConfigurationConstants.UploadOptions.PackageId.SYS_PROP} =<PACKAGE_ID>') " +
28
+ " or gatling.enterprise.simulationId (or pass it with '-D${ ConfigurationConstants.UploadOptions.SimulationId.SYS_PROP} =<SIMULATION_ID>') to upload a package." +
29
+ " Please see https://docs.gatling.io/reference/integrations/build-tools/gradle-plugin/#running-your-simulations-on-gatling-enterprise-cloud for more information." )
30
+ }
31
+ }
32
+ }
33
+ }
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ final class GatlingPlugin implements Plugin<Project> {
14
14
15
15
public static def ENTERPRISE_PACKAGE_TASK_NAME = " gatlingEnterprisePackage"
16
16
17
+ public static def ENTERPRISE_UPLOAD_TASK_NAME = " gatlingEnterpriseUpload"
18
+
17
19
public static def ENTERPRISE_START_TASK_NAME = " gatlingEnterpriseStart"
18
20
19
21
public static def ENTERPRISE_DEPLOY_TASK_NAME = " gatlingEnterpriseDeploy"
@@ -33,10 +35,18 @@ final class GatlingPlugin implements Plugin<Project> {
33
35
}
34
36
35
37
def gatlingEnterprisePackageTask = registerEnterprisePackageTask(project)
38
+ registerEnterpriseUploadTask(project, gatlingEnterprisePackageTask)
36
39
registerEnterpriseDeployTask(project, gatlingEnterprisePackageTask)
37
40
registerEnterpriseStartTask(project, gatlingEnterprisePackageTask)
38
41
}
39
42
43
+ private void registerEnterpriseUploadTask (Project project , TaskProvider<GatlingEnterprisePackageTask > gatlingEnterprisePackageTask ) {
44
+ project. tasks. register(ENTERPRISE_UPLOAD_TASK_NAME , GatlingEnterpriseUploadTask . class) {
45
+ inputs. files gatlingEnterprisePackageTask
46
+ dependsOn(gatlingEnterprisePackageTask)
47
+ }
48
+ }
49
+
40
50
private TaskProvider<GatlingEnterpriseDeployTask > registerEnterpriseDeployTask (Project project , TaskProvider<GatlingEnterprisePackageTask > gatlingEnterprisePackageTask ) {
41
51
project. tasks. register(ENTERPRISE_DEPLOY_TASK_NAME , GatlingEnterpriseDeployTask . class) {
42
52
inputs. files gatlingEnterprisePackageTask
Original file line number Diff line number Diff line change @@ -130,6 +130,13 @@ class GatlingPluginExtension {
130
130
setPackageDescriptorFilename(packageDescriptorFilename)
131
131
}
132
132
133
+ @Input
134
+ @Optional
135
+ UUID getSimulationId () {
136
+ var str = ConfigurationConstants.UploadOptions.SimulationId . valueOf(simulationId)
137
+ str ? UUID . fromString(str) : null
138
+ }
139
+
133
140
@Input
134
141
@Optional
135
142
String getSimulationName () {
@@ -152,6 +159,13 @@ class GatlingPluginExtension {
152
159
ConfigurationConstants.ApiToken . valueOf(apiToken)
153
160
}
154
161
162
+ @Input
163
+ @Optional
164
+ UUID getPackageId () {
165
+ var str = ConfigurationConstants.UploadOptions.PackageId . valueOf(packageId)
166
+ str ? UUID . fromString(str) : null
167
+ }
168
+
155
169
@Input
156
170
@Optional
157
171
URL getApiUrl () {
You can’t perform that action at this time.
0 commit comments