# GitLab CI/CD ![](https://about.staging.gitlab.com/images/ci/ci-cd-test-deploy-illustration_2x.png) --- # GitLab CI/CD <!-- Put the link to this slide here so people can follow --> By: Fredy Pulido, Linux User since 2002 __ * Linagora: SRE (starting), HDP packaging. * Karisma (NGO in Colombia): Sysadmin. * Free Software & Privacy activist. I :heart: Automation --- # Today * Presentation (45m) * CI/CD/CD Concepts * GitlabCI architecture * Karisma's pipeline for Jekyll * Discussion (15m) * Questions * Comments ... * Workshop (30m) * Simple pipeline --- # Presentation CI/CD * CI/CD/CD Concepts --- ## Definitions * CI: Continuous integration * CD: Continuous Delivery * CD: Continuous Deployment * Pipeline: where automation happen :gear: --- ### CI Practice of merging all developers' working copies to a shared mainline several times a day. Grady Booch first proposed the term CI in his 1991 method, although he did not advocate integrating several times a day. Extreme programming (XP) adopted the concept of CI and did advocate integrating more than once per day – perhaps as many as tens of times per day. ([Wikipedia](https://en.wikipedia.org/wiki/Continuous_integration)) --- ### CI Before merging is good idea to run some tests. ![](https://maxcdn.icons8.com/app/uploads/2018/01/404-file-not-found.png) --- ### CD (Delivery) Approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time and, when releasing the software, without doing so manually. The approach helps reduce the cost, time, and risk of delivering changes by allowing for more incremental updates to applications in production. A straightforward and repeatable deployment process is important for continuous delivery. ([Wikipedia](https://en.wikipedia.org/wiki/Continuous_delivery)) --- ### CD (Delivery) Something like this but the left side is a robot :thinking_face: ![](https://www.kovair.com/blog/wp-content/uploads/2015/04/Dev-and-Ops-The-Wall.jpg) --- ### CD (Deployment) Approach in which software functionalities are delivered frequently through automated deployments. CD contrasts with continuous delivery, a similar approach in which software functionalities are also frequently delivered and deemed to be potentially capable of being deployed but are actually not deployed. [Wikipedia](https://en.wikipedia.org/wiki/Continuous_deployment) --- ### CD (Deployment) Automated from A-Z ![](https://about.staging.gitlab.com/images/blogimages/cicd_pipeline_infograph.png) --- ### CI/CD Recap ![](https://edge.siriuscom.com/_wss/clients/509/assets/503/CI-CD-graphic.PNG) --- ### CI/CD Recap All this new way ... looks like :thinking_face: ``` ./configure make make install make test ``` With a magic cherry on top to help us to do/operate software in a collaborative way. And made :peace_symbol: between Devs and Ops. --- # Presentation CI/CD * GitlabCI architecture --- ## GitlabCI Architecture ![](https://about.staging.gitlab.com/images/ci/ci-cd-architecture_2x.png) --- ### Gitlab Server GitLab CI/CD is a part of GitLab, a web application with an API that stores its state in a database. It manages projects/builds and provides a nice user interface, besides all the features of GitLab. ([Gitlab website](https://about.staging.gitlab.com/stages-devops-lifecycle/continuous-integration/)) --- ### Gitlab Runner Is an application which processes builds. It can be deployed separately and works with GitLab CI/CD through an API. ([Gitlab website](https://about.staging.gitlab.com/stages-devops-lifecycle/continuous-integration/)) --- ### Gitlab pipeline YAML code (`.gitlab-ci.yml`) where the automation happen :gear: :rocket: ![](https://docs.gitlab.com/ee/ci/pipelines/img/pipelines.png) * Stages (build, test ..) in serial * Jobs (test1, test2) in paralell * You can use rules to get in control --- # Presentation CI/CD * My story at Karisma --- ## (1) My story at Karisma * K: A 3rd party is doing a webapp for us ... * Me: Do not anonce release date because ... * K: No worries we trust this provider ... * Me: Ok, at least give me 2 days to deploy it. * Me: 1 Week left, any news? I'm worried. * K: They told us they are fixing a small bug. * Me: 3 days before: I think you should cancel. * K: They told us tomorrow all will be OK. --- ## (2) My story at Karisma * Me: 2 days before, tell them to deliver now. * 3rd: Bug almost fixed. We will deliver at 5pm. * Me: Deliver your code now to test my deploy. * 3rd: Can we do a call, It is about WP config. * Me: The requirement was for an HTML5 app. * K: Was a new dev, they asigned a senior. * Me: Ok but weekly delivery. * Me: Deploy at http://exapmple.com/app-test/ --- ## (3) My story at Karisma * Our "Senior" was a "Junior" but at least a dev. * Dev: I'm not HTML5 expert. I know PHP. * Me: We wanted to avoid PHP but do it! * Dev: I did X feature please deploy * Me: git pull && cp -a . /var/www/app/ (kind of) * Me: I can script it into deploy.sh * Me: Cron hourly (my first CD/CD) :gear: :shit: --- ## (4) My story at Karisma * All broken when moving from /app-test to /app * Our 3rd was graphical design agency. * Graphical designers deliver :shit: Software * I learn Agile, Docker and GitlabCI * K do not do apps, do informative microsites * No new WP per microsite, Jekyll (no updates) * K pay for Jekyll themes (nothing from scratch) * We pay real devs to modify themes. Thats it. --- ## (5) My story at Karisma * Now we deliver a vanilla Jekyll in 4 hours * GitlabCI pipeline CI/CD (deploy) * Enviroments per branch (prod, preprod, ...) * Setup is not fully automated but: * WIP automate ephimeral envs with Terraform * WIP automate provisioning with Ansible * WIP generate code instead of copy/paste * ToDo: gitlab projects conf using Terraform * We are close to get automation from A-Z :fireworks: --- # Demo: Pipeline Karisma --- # Discussion --- # Workshop * Chose site from [html5up](https://html5up.net/) * Follow [Gitalb Pages documentation](https://docs.gitlab.com/ee/user/project/pages/) * Create a gitlabproject for this workshop * Add the code from html5up to your repo * Use the pipeline template for HTML
{"metaMigratedAt":"2023-06-15T22:23:35.508Z","metaMigratedFrom":"YAML","title":"Talk slides template","breaks":true,"description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"6a3f3a12-63a2-474b-b372-7006a02c273a\",\"add\":10390,\"del\":4046}]"}
    293 views