I am new to both GITLAB and GATLING. I am trying to implement shift-left performance testing as part of CI/CD pipeline using the mentioned tool. Although I am very proficient with Jenkins and Jmeter. I am trying to write Gitlab Pipeline ID to gatling simulation log file.
I have referred to the GITLAB variable and $CI_PIPELINE_IID is used to expose the pipeline execution ID. In case of scala I can fetch or infuse environment variables using JAVA_OPTS but not able to fetch the gitlab pipeline id.
I did some further research and i was able to print the pipeline ID on the Gitlab Console
$ echo $CI_PIPELINE_ID
141683
Further I read as part of scala[Gitlab], CI variables can be used as ENV variables during the build, so retrieving them as System.getEnv("$CI_PIPELINE_IID")
But while i try the same I get null value.
val varPipelineId = System.getenv("$CI_PIPELINE_ID")
println(varPipelineId)
Console log:
$ echo $CI_PIPELINE_ID
141694
$ mkdir /opt/gatling/user-files/simulations/cloudnative/
$ cp gatling-reports/cloudnativems.scala /opt/gatling/user-files/simulations/cloudnative/
$ /opt/gatling/bin/gatling.sh -s cloudnative.cloudnativems
GATLING_HOME is set to /opt/gatling
null
Second Part of the requirement: I want to write the value of pipeline id in gatling simulation.log file with each log entry
Actual format of simulation.log
REQUEST 1 account_movement_post 1553663401413 1553663404218 KO status.find.in(200,201,202,203,204,205,206,207,208,209,303), found 500
Modified format of simulation.log
REQUEST 1 account_movement_post 1553663401413 1553663404218 KO status.find.in(200,201,202,203,204,205,206,207,208,209,303), found 500 [pipeline_id]