This repository includes the script and file to enable running GitLab and SonarQube hosted locally using docker-compose.
It supports few possible scenarios for running the DevSecOps pipelines from on-demand runner only to fully operational GitLab Platform with SonarQube operational instance.
The following assumptions were taken into account for this concept:
- CI/CD Pipeline is essential to make sure developers can use SSDLC directly without the continues support of DevOps.
- Git Integration is highly important for the successful automation of the DevSecOps.
- Containers (Docker), provide a consist and standard environment across developers, teams and organizations to develop, scan and automate SDLC.
- The files and scripts were created and run on bash shell system (Ubuntu Server).
NB! For Windows System, adaptation and verification will be required.
- Docker - used as the containers management and execution platform.
By using docker we can enforce and maintain exactly identical execution environment no matter what OS or machines are used. - SonarQube - used as the static code analysis system. The community edition had been selected for the concept purpose.
- GitLab Pipelines - used to script and execute the DevSecOps process. GitLab pipelines are YAML declaratives format files (usually named .gitlab-ci.yml) which contains the job execution instructions.
- GitLab Runner - used as the agent to execute the pipeline. The GitLab Runner is usually deployed as part of a large more complex GitLab platform. However, for this concept – they will be used as standalone pipeline executers
- Install Docker Desktop – follow and complete the instructions at https://docs.docker.com/desktop/
- SonarQube:
- For local installation of SonarQube run the script scripts/init-all.sh.
- When the installation is finished, log-in to the local instance and generate a Token by following this procedure:
https://docs.sonarqube.org/latest/user-guide/user-token/
- Add the GitLab pipeline file (.gitlab-ci.yml) to the source code repository root
(Example file is located in pipeline/.gitlab-ci.yml) - Make sure you commit all changes (no need to push to remote)
- Update local-run.env file with the relevant fields and credentials
- Run the script scripts/exec-localy.sh This script setup and run the pipeline via SonarQube