Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

CI-CD WITH GITLAB WORKFLOW

95 vues

Publié le

CI-CD WITH GITLAB WORKFLOW

Publié dans : Technologie
  • Soyez le premier à commenter

CI-CD WITH GITLAB WORKFLOW

  1. 1. CI CD WORKFLOW WITH GITLAB By Team CALMS Squad
  2. 2. Tools used GitLab:- To manage code and versioning Docker:- To build ship and run containers Gitlab Runner:- For ci Ansible:- For cicd provisioning instance
  3. 3. Gitlab CI/CD with Ansible
  4. 4. Workflow Gitlab ⇒ Gitlab-Runner => build docker image => Ansible Developers pushes their code to repo. Gitlab-Runner build job then triggers via webhook and by that application is packaged into docker image and pushed to registry. And Gitlab-Runner build job runs Ansible playbook which will provision server according to Dev/stage/production environment with its dependencies and requirements. And after successful/unsuccessful build notification is send to team.
  5. 5. Gitlab-Runner build jobs examples Running shell commands Taking pull from git Like installing dependencies via composer install Cleaning Drupal caches via drush cr Updating database via drush updb Importing configs via drush cim and again clearing caches via drush cr
  6. 6. Running Ansible playbook via Gitlab-Runner Benefits of running Ansible playbook is everything can be managed from one place i.e playbook Means one can clone code from repo Installing dependencies and package app into containers and deploy it on server. When compared to Gitlab-runner shell commands, In playbook the shell commands will also be executed by the playbook itself so all the things like installing dependencies, clearing caches, updating database and importing configs can be done easily.
  7. 7. Shell command example:- ● Clone code ○ if cd project_name; ○ then ○ git branch; git status; git checkout {{branch_name}}; git pull origin {{branch_name}}; ○ docker exec -i {{container_name}} composer install -d /var/www/html/{{project_name}}; ○ docker exec -i {{container_name}} drush cim -y --root=/var/www/html/{{project_name}}/web; ○ docker exec -i {{container_name}} drush updb -y--root=/var/www/html/{{project_name}}/web; ○ docker exec -i {{container_name}} drush cr -y --root=/var/www/html/{{project_name}}/web; ○ else ○ git clone {{github_repo_url}} project_name; ○ cd findamol; ○ git branch; git status; git checkout {{branch_name}}; git pull origin {{branch_name}}; ○ docker exec -i {{container_name}} composer install -d /var/www/html/{{project_name}}; ○ docker exec -i {{container_name}} drush cim -y --root=/var/www/html/{{project_name}}/web; ○ docker exec -i {{container_name}} drush updb -y --root=/var/www/html/{{project_name}}/web; ○ docker exec -i {{container_name}} drush cr -y --root=/var/www/html/{{project_name}}/web; ○ fi
  8. 8. Ansible playbook example:- ● Run Playbook which contains task for cloning code, installing dependencies, updating database and configs and clearing caches ● Tasks:- ○ Clone code ○ Setup project ○ Start containers ○ Install dependencies (composer install) ○ Import configs (drush cim -y) ○ Updating database (drush updb) ○ Clear caches (drush cr)
  9. 9. Reach us at : Email: 1. hi@addwebsolution.com or 2. contact@addwebsolution.com Phone: 1. +1 305 432 2289 2. +44 141 628 2177 3. +91 903 317 7471 We are Social: Team Culture | LinkedIn | Happy Clients | Twitter

×