- Install and configuring Docker
- Download this project
- Pull Jenkins docker image:
-
docker pull jenkins/jenkins:lts
-
- Run the Jenkins container:
-
docker run --name jenkins --rm -p 8282:8080 -p 50000:50000 -p 8000:8000 -v jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):$(which docker) jenkins/jenkins:lts
-
- Access Jenkins: http://localhost:8282/
- Install suggested plugins, click on Skip and continue as admin or Create First Admin User then Verify the URL, finish and start
- On Manage Jenkins, go to Manage Plugins and install on Available plugins the Go Plugin for GoLang
- Install the Gatling plugin too
- Still in Manage Jenkins go to Global Tool Configuration. In Add Go, set it to Install automatically from golang.org, name it as go-1.20 apply and save it.
- On Dashboard click in
New Item
- Set the name, choose
Pipeline
and clickOK
- Go to
Pipeline
and choose Pipeline script from SCM and fill as following:
- SCM: Git
- Repository URL: https://github.com/Gabriely-get/Go-Calculator-with-Gatling-and-Jenkins.git
- Branch Specifier: */main
- Choose the Jenkinsfile path. The steps to create the two jobs are the same, the only thing that will change is the path:
- ./job1/Jenkinsfile
- ./job2/Jenkinsfile
- Run first Calculator job and after Gatling Stress Test job
- When the job Gatling Stress Test finish, click in the finished build and go to Workspaces of the job
- Click on the folder link
- Follow the path: gatling-charts-highcharts-bundle-3.9.0/results/
- Choose the result and click on all files in zip
- Extract it and open the index.html with a Browser
- The result will look like the image below: