{"id":14984653,"url":"https://github.com/aahad91/git-jenk-dock","last_synced_at":"2026-01-03T20:03:03.156Z","repository":{"id":190146603,"uuid":"265558682","full_name":"aahad91/git-jenk-dock","owner":"aahad91","description":"Docker-based solution for GitLab and Jenkins","archived":false,"fork":false,"pushed_at":"2020-11-24T21:06:17.000Z","size":20587,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T07:09:49.218Z","etag":null,"topics":["docker","docker-compose","gitlab","gitlab-ci","gitlab-runner","integration","jenkins","jenkins-ci","owasp-dependencycheck","postgresql","sonarqube"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aahad91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-05-20T12:29:39.000Z","updated_at":"2020-11-24T21:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"01e03b9c-6cc7-4985-abf1-a23aca80f526","html_url":"https://github.com/aahad91/git-jenk-dock","commit_stats":null,"previous_names":["aahad91/git-jenk-dock"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aahad91%2Fgit-jenk-dock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aahad91%2Fgit-jenk-dock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aahad91%2Fgit-jenk-dock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aahad91%2Fgit-jenk-dock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aahad91","download_url":"https://codeload.github.com/aahad91/git-jenk-dock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926203,"owners_count":20369945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-compose","gitlab","gitlab-ci","gitlab-runner","integration","jenkins","jenkins-ci","owasp-dependencycheck","postgresql","sonarqube"],"created_at":"2024-09-24T14:09:28.122Z","updated_at":"2026-01-03T20:02:58.135Z","avatar_url":"https://github.com/aahad91.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Docker-compose CI](https://github.com/aahad91/git-jenk-dock/workflows/Docker-compose%20CI/badge.svg?branch=master)\n# git-jenk-dock\n## Docker-based solution for GitLab, GitLab Runner, Jenkins and SonarQube\n\n### Documentation for Installation, Integration, Plugins Installation and Pipeline Testing\n\n#### Requirement\n\n- Docker (Installed)\n- Docker-compose (Installed)\n\n### Installation\n\n```bash\n#For Ubuntu to resolve virtual memory issue of Sonarqube\nsudo sysctl -w vm.max_map_count=262144\n\nsudo docker-compose -f docker-compose.yaml up\n\n#New terminal\nsudo docker exec -it -u root jenkins chmod 777 /var/run/docker.sock\n```\n\n#### URLs\n\nBrowse to following Urls to verify successful installation of Gitlab, Jenkins and SonarQube.\n\n- **Gitlab:** http://localhost:8081\n  - **Login:** \n  - **Password:** \n- **Jenkins:** http://localhost:8095\n  - **Login:** \n  - **Password:** \n- **SonarQube:** http://localhost:9000\n  - **Login:** admin\n  - **Password:** admin \n\n#### Gitlab Configuration\n\n- After browsing to above mentioned url of gitlab, initial registration page will show up. Set the new password for root user of Gitlab.\n\n![root-password-set](images/git-config-1.png)\n\n- Login with the newly created password\n\n![root-login](images/git-config-2.png)\n\n- Gitlab Homepage\n\n![git-home](images/git-homepage.png)\n\n### Gitlab Runner Integration\n\n#### Gitlab\n\n- Navigate to ***Admin Area*** \u003e ***Runners*** and copy the ***Registration Token***.\n\n![gitlab-runner1](images/gitlab-runner-1.png)\n\n#### Gitlab Runner\n\n```bash\n# Command to register runner with gitlab\ngitlab-runner register -n --url http://\u003cgitlab-ip\u003e:80/ --registration-token {token from gitlab} --clone-url http://\u003cgitlab-ip\u003e:80/ --executor docker --docker-image \"docker:latest\" --docker-privileged\n\n# Execute\nsudo docker exec -it gitlab-runner gitlab-runner register -n --url http://192.168.0.105:8081/ --registration-token m4zgS3wQuiPLusTHbzD1 --clone-url http://192.168.0.105:8081/ --executor docker --docker-image \"docker:latest\" --docker-privileged\n```\n\n- Verify the added runner.\n\n![gitlab-runner2](images/gitlab-runner-2.png)\n\n#### Jenkins Configuration\n\n- Browse to above mentioned url of jenkins and get the Administrator password from the mentioned path:\n\n```bash\nsudo docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword\n```\n\n![jenkins-conf](images/jenkins-config-1.png)\n\n- Select the \"Select plugins to Install\", search and enable gitlab, afterwards click on the Install.\n\n![jenkins-plugins](images/jenkins-config-2.png)\n\n- Wait till all the plugins are installed.\n\n![plugins-install](images/jenkins-config-3.png)\n\n- Set Admin user and password.\n\n![user-create](images/jenkins-config-4.png)\n\n- Set the default url for jenkins for 3rd party access. For-example integration with gitlab and email configuration.\n\n![instance-conf](images/jenkins-config-5.png)\n\n- All set!\n\n![jenkins-installed](images/jenkins-config-6.png)\n\n- Jenkins Homepage\n\n![jenkins-homepage](images/jenkins-config-7.png)\n\n#### Installing required plugins for Jenkins\n\n- OWASP Dependency-Check\n- Docker\n- Docker pipeline\n- Navigate to **_Manage Jenkins_** \u003e **_Manage Plugins_**. Click on ***Available*** tab and search for OWASP Dependency-Check and Docker afterwards click on Download now and install after restart.\n\n![](images/jenkins-plugin-install-5.png)\n\n![](images/jenkins-plugin-install-6.png)\n\n- Verify the successfull installation of OWASP Dependency-Check plugin by navigating to **_Manage Jenkins_** \u003e **_Manage Plugins_** and click on ***installed*** tab.\n\n![](images/jenkins-plugin-install-7.png) \n\n### Integration of Gitlab and Jenkins\n\n#### Gitlab\n\n- Generate authentication token. *Navigate to **Settings** \u003e **Access Token***. Do as follow:\n\n![git-token](images/git-inti-1.png)\n\n#### Jenkins\n\n- Add connection to Gitlab from jenkins. *Navigate to **Manage Jenkins** \u003e **Configure System***. Search for Gitlab tab. Add Name, Url of gitlab, token and test the connection as follow.\n\n![add-conn](images/jenkins-inti-1.png)\n\n![add-token](images/jenkins-inti-2.png)\n\n### SonarQube\n\n- Browse ot Url http://localhost:9000 \n\n![](images/sonarqube-1.png)\n\n- Click on login and enter the credentials for the first login and later can be changed to desired password:\n  - Username: admin\n  - Password: admin\n\n![](images/sonarqube-2.png)\n\n![](images/sonarqube-3.png)\n\n#### Installing OWASP Dependency Checker for SonarQube\n\n- Click on ***Administration*** -\u003e ***Marketplace***. Type dependency-check in search bar and click install. \n\n![](images/sonarqube-4.png)\n\n- Click on ***Restart Server*** on the top to proceed the installation.\n\n![](images/sonarqube-5.png)\n\n- Verify the successfull installation of OWASP Dependency Checker plugin. Navigate to ***Administration*** \u003e ***Marketplace***, and click on Plugins installed.\n\n![](images/sonarqube-6.png)\n\n### Test Pipeline\n\n#### Gitlab\n\n- Click on **Create a project** and select **Import Project**, after that copy and paste the repo: **https://github.com/aahad91/maven.git**. Set project to public and finally click on Create project.\n\n![](images/git-repo-1.png)\n\n![repo-2](images/git-repo-2.png)\n\n#### Jenkins\n\n##### Pipeline\n\n- From Home page click on \"New Item\". Add the name for pipeline and select pipeline.\n\n![create-pipeline](images/jenkins-pipeline-1.png)\n\n- Under Build Triggers section, select \"Build when a change is pushed to GitLab. GitLab webhook URL: http://192.168.0.105:8095/project/maven-dependency-check\".\n\n![](images/jenkins-pipeline-6.png)\n\n- In pipeline section, select \"Pipeline script from SCM\" and set SCM to \"Git\". Afterwards add URL of the git repo.\n\n![pipeline-config](images/jenkins-pipeline-2.png)\n\n- Click on Build now to test the pipeline.\n\n![run-pipeline](images/jenkins-pipeline-3.png)\n\n- Verfiy the pipeline is executed successfully.\n\n![](images/jenkins-pipeline-4.png)\n\n![](images/jenkins-pipeline-5.png)\n\n##### Dependency check\n\n- Configure the OWASP dependency check. Navigate to ***Manage Jenkins \u003e Global Tool Configuration***. In Dependency-Check section, click on **Add Dependency-Check**. Set the name and click save.\n\n![](images/jenkins-owasp-1.png)\n\n- From Home page click on \"New Item\". Add the name and select freestyle project.\n\n![](images/jenkins-owasp-2.png)\n\n- In settings, under Source Code Management section. Add the repository Url.\n\n![](images/jenkins-owasp-3.png)\n\n- Under Build Triggers section, select \"Build when a change is pushed to GitLab. GitLab webhook URL: http://192.168.0.105:8095/project/maven-dependency-check\"\n\n![](images/jenkins-owasp-7.png)\n\n- Under Build section select **Invoke Dependency-Check** and under Post-build Actions select **Publish Dependency-Check results**. For build section, in Arguments add the following and click on save:\n  - --format XML\n  - --format HTML\n\n![](images/jenkins-owasp-4.png)\n\n- Click on **Build Now** to see the results.\n\n![](images/jenkins-owasp-5.png)\n\n![](images/jenkins-owasp-6.png)\n\n##### Gitlab webhook for automatically triggering Jenkins pipeline and OWASP Dependency-Check\n\n![](images/git-webhook.png)\n\n#### Gitlab Runner and SonarQube\n\n##### SonarQube\n\n- From the main page click on **Create new project**. Add the **Project-key** and click on Set Up.\n\n![](images/sonarqube-7.png)\n\n- Provide the name for the Key and click on Generate. Copy the token.\n\n![](images/sonarqube-8.png)\n\n##### Gitlab\n\n- Edit the **.gitlab-ci.yml**. Add the token and SonarQube Url then Commit.\n\n![](images/git-ci-1.png)\n\n- Navigate to ***CI/CD \u003e Pipelines***. To verify the Gitlab Runner pipeline.\n\n![](images/gitlab-runner-3.png)\n\n![](images/gitlab-runner-4.png)\n\n##### SonarQube\n\n- Verify the analysis on SonarQube.\n\n![](images/sonarqube-9.png)\n\n------\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faahad91%2Fgit-jenk-dock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faahad91%2Fgit-jenk-dock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faahad91%2Fgit-jenk-dock/lists"}