Add jenkins pipeline for gatling performance testing
Feature: Issue 13397
Change-Id: I49775d262329bfc5b63d239bbf702759383cdb01
diff --git a/jenkins/gatlingTestPipeline.groovy b/jenkins/gatlingTestPipeline.groovy
new file mode 100644
index 0000000..7c5b97a
--- /dev/null
+++ b/jenkins/gatlingTestPipeline.groovy
@@ -0,0 +1,49 @@
+pipeline {
+ agent { label 'bazel-debian' }
+ parameters {
+ string(name: 'GERRIT_HTTP_URL', description: 'Gerrit GUI URL')
+ string(name: 'GERRIT_SSH_URL', description: 'Gerrit SSH URL')
+ string(name: 'GIT_HTTP_USERNAME', description: 'Username for Git/HTTP testing')
+ string(name: 'GIT_HTTP_PASSWORD', description: 'Password for Git/HTTP testing')
+ string(name: 'GERRIT_PROJECT', defaultValue: 'load-test', description: 'Gerrit project for load test')
+ string(name: 'ACCOUNT_COOKIE', description: 'HTTP Cookie to access the Gerrit GUI')
+ string(name: 'XSRF_TOKEN', description: 'XSRF_TOKEN Cookie to access the Gerrit GUI for pOST operations')
+ string(name: 'NUM_USERS', defaultValue: '10', description: 'Number of concurrent user sessions')
+ string(name: 'DURATION', defaultValue: '2 minutes', description: 'Total duration of the test')
+
+ }
+ stages{
+ stage('Pull newest Gatling tests docker image') {
+ steps {
+ sh 'docker pull gerritforge/gatling-sbt-gerrit-test'
+ }
+ }
+
+ stage('Run Gatling tests') {
+ steps {
+ script {
+ writeFile(file:"simulation.env", text: """
+ GERRIT_HTTP_URL="${GERRIT_HTTP_URL}"
+ GERRIT_SSH_URL="${GERRIT_SSH_URL}"
+ ACCOUNT_COOKIE="${ACCOUNT_COOKIE}"
+ GIT_HTTP_USERNAME="${GIT_HTTP_USERNAME}"
+ GIT_HTTP_PASSWORD="${GIT_HTTP_PASSWORD}"
+ XSRF_TOKEN="${XSRF_TOKEN}"
+ GERRIT_PROJECT="${GERRIT_PROJECT}"
+ GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+ """)
+ }
+ script {
+ for (simulation in ["GerritGitSimulation", "GerritRestSimulation"]) {
+ sh """\
+ docker run --rm --env-file simulation.env -v `pwd`/target/gatling:/opt/gatling/results \
+ gerritforge/gatling-sbt-gerrit-test -s gerritforge.${simulation}
+ """
+ }
+ }
+
+ gatlingArchive()
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/jenkins/gatlingTestPipeline.yaml b/jenkins/gatlingTestPipeline.yaml
new file mode 100644
index 0000000..78e9eba
--- /dev/null
+++ b/jenkins/gatlingTestPipeline.yaml
@@ -0,0 +1,6 @@
+- job:
+ name: gatling-gerrit-test
+ project-type: pipeline
+ dsl: !include-raw: gatlingTestPipeline.groovy
+ triggers:
+ - timed: "@midnight"