GitLab CI/CD Complete Course Index

Pavel 08.12.2025 19:26 29 просмотров

Course: GitLab CI/CD for Beginners (ADV-IT)
YouTube Playlist: https://www.youtube.com/watch?v=R1a-1JYfiQA&list=PLg5SS_4L6LYuJxTrdU5vzBaVGlZko8Hsy
Author: Denis Astahov (ADV-IT)
Language: Russian 🇷🇺


📚 Course Structure

Main Topics (4 files)

# File Topics Covered Level
1 01-gitlab-ci-basics.md CI/CD basics, pipeline structure, stages, jobs, variables Beginner
2 02-gitlab-setup-pipeline.md Setup GitLab, create project, first pipeline, Docker, artifacts Beginner
3 03-gitlab-advanced-patterns.md Rules, conditions, matrix, environments, retry, production patterns Intermediate
4 04-gitlab-commands-reference.md Commands, troubleshooting, best practices, quick reference Reference
5 05-gitlab-course-index.md This file - course guide and learning paths Guide

🎯 Course Overview

Урок 1: Основы CI/CD

Topics: Что такое CI/CD, stages, jobs, переменные, Docker images Time: 1-2 часа Outcome: Понимаете как работают pipeline'ы

Урок 2-4: Настройка и первый pipeline

Topics: Создание проекта, .gitlab-ci.yml, первый pipeline, runners Time: 2-3 часа Outcome: Запущенный pipeline на вашем проекте

Урок 5-8: Advanced patterns

Topics: Rules, conditions, matrix, environments, production patterns Time: 3-4 часа Outcome: Production-ready pipeline'ы

Урок 9+: Complete pipelines

Topics: Полные рабочие pipeline'ы, интеграция с Docker, Kubernetes, облаком Time: 4-6 часов Outcome: Enterprise-level CI/CD система


🚀 Learning Paths

Path 1: Quick Start (2-3 hours)

  1. 01-gitlab-ci-basics.md (1 hour)
  2. 02-gitlab-setup-pipeline.md (basics) (1-2 hours)

Result: Работающий простой pipeline


Path 2: Complete Setup (6-8 hours)

  1. 01-gitlab-ci-basics.md
  2. 02-gitlab-setup-pipeline.md (full)
  3. 03-gitlab-advanced-patterns.md (first half)

Result: Production-like pipeline с правильной структурой


Path 3: Expert (15-20 hours)

  1. All files
  2. Practice building real pipelines
  3. Integrate with Docker/Kubernetes
  4. Setup CI/CD for production

Result: Full CI/CD expertise


💡 Key Concepts

Pipeline Structure

Code Push ──► Pipeline Trigger
        Stage: Build (Parallel)
├─ Build Job ──► Artifacts
        Stage: Test (Parallel)
├─ Test 1 Job
├─ Test 2 Job
├─ Lint Job
        Stage: Deploy (Conditional)
├─ Deploy Dev (if develop branch)
├─ Deploy Prod (if main branch, manual)

Job Dependencies

build_job
├─ test_unit (needs: build_job)
├─ test_integration (needs: build_job)
│   └─ deploy (needs: test_unit, test_integration)

✅ Learning Checklist

Basics

  • [ ] Понимаете stages и jobs
  • [ ] Знаете как работают artifacts
  • [ ] Используете переменные
  • [ ] Видите логи jobs

Pipeline Creation

  • [ ] Создали GitLab проект
  • [ ] Создали .gitlab-ci.yml файл
  • [ ] Запустили первый pipeline
  • [ ] Смотрите результаты в UI

Intermediate

  • [ ] Используете rules для условного выполнения
  • [ ] Используете Docker образы
  • [ ] Используете caching
  • [ ] Используете needs для зависимостей

Advanced

  • [ ] Используете matrix для параллельных вариантов
  • [ ] Настроили environments
  • [ ] Используете retry и timeout
  • [ ] Пишете production pipeline'ы

DAY 1: Theory (2-3 часа)
├─ 01-gitlab-ci-basics.md (full reading)
└─ Understand stages, jobs, artifacts

DAY 2: First Pipeline (2-3 часа)
├─ 02-gitlab-setup-pipeline.md (first half)
├─ Create GitLab project
└─ Write first .gitlab-ci.yml

DAY 3: Artifacts & Variables (2-3 часа)
├─ 02-gitlab-setup-pipeline.md (second half)
├─ Use artifacts between jobs
└─ Use predefined variables

DAY 4: Advanced Features (2-3 часа)
├─ 03-gitlab-advanced-patterns.md
├─ Use rules for conditional execution
└─ Use environments

DAY 5: Production Setup (2-3 часа)
├─ 04-gitlab-commands-reference.md
├─ Build production pipeline
└─ Add security and best practices

🔧 Common Use Cases

Use Case 1: Simple Build & Test

stages:
  - build
  - test

build:
  stage: build
  script:
    - npm run build

test:
  stage: test
  needs: ["build"]
  script:
    - npm test

Use Case 2: Multi-environment Deploy

deploy_dev:
  rules:
    - if: '$CI_COMMIT_BRANCH == "develop"'
  environment: development
  script: ./deploy.sh dev

deploy_prod:
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: manual
  environment: production
  script: ./deploy.sh prod

Use Case 3: Docker Build & Push

build_docker:
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker build -t my-app:${CI_COMMIT_SHORT_SHA} .
    - docker push registry.gitlab.com/user/my-app:${CI_COMMIT_SHORT_SHA}

Use Case 4: Parallel Matrix Tests

test:
  parallel:
    matrix:
      - OS: [ubuntu, debian]
        NODE: ["14", "16", "18"]
  script:
    - docker run -e NODE_VERSION=$NODE $OS npm test

🎓 Real Projects

Project 1: Node.js App CI/CD

Time: 2-3 hours
Requirements:
1. Build Node.js app
2. Run npm test
3. Build Docker image
4. Push to registry

Project 2: Multi-branch Deployment

Time: 3-4 hours
Requirements:
1. Develop branch  deploy to staging
2. Main branch  deploy to production
3. PR branch  run tests only
4. All branches  build

Project 3: Complete Pipeline

Time: 5-8 hours
Requirements:
1. Build and test
2. Docker image creation
3. Push to registry
4. Deploy to Kubernetes
5. Run smoke tests
6. Notify on Slack

📚 Additional Resources

Official Documentation

  • GitLab CI/CD Docs: https://docs.gitlab.com/ee/ci/
  • GitLab Runner: https://docs.gitlab.com/runner/
  • Pipeline Syntax: https://docs.gitlab.com/ee/ci/yaml/
  • Best Practices: https://docs.gitlab.com/ee/ci/pipelines/pipeline_efficiency.html

Community & Support

  • GitLab Community: https://forum.gitlab.com/
  • GitLab Slack: https://slack.gitlab.com/
  • GitHub Issues: https://github.com/gitlabrunner/
  • Reddit: https://reddit.com/r/gitlab/

🔒 Security Best Practices

✅ DO

  • ✅ Use protected branches for production
  • ✅ Use environments with protection
  • ✅ Store secrets in GitLab CI/CD variables
  • ✅ Use predefined variables instead of hardcoding
  • ✅ Require approval for production deploys
  • ✅ Use specific Docker image versions
  • ✅ Scan dependencies for vulnerabilities
  • ✅ Use artifact expiration for cleanup

❌ DON'T

  • ❌ Store passwords in .gitlab-ci.yml
  • ❌ Use when: always for all jobs
  • ❌ Deploy automatically to production
  • ❌ Use latest Docker images (use specific tags)
  • ❌ Give all runners full access
  • ❌ Commit secrets to repository
  • ❌ Skip test stage
  • ❌ Ignore pipeline failures

📊 Pipeline Performance Tips

# ✅ Use cache for faster builds
cache:
  paths:
    - node_modules/

# ✅ Use artifacts only for necessary files
artifacts:
  paths:
    - dist/
  expire_in: 1 week

# ✅ Run tests in parallel
test_unit:
  stage: test
test_integration:
  stage: test

# ✅ Use specific Docker images
image: node:16-alpine

# ✅ Keep jobs simple and focused
# Don't do everything in one job

📋 Quick Reference Commands

What Command
Clone repo git clone https://gitlab.com/user/project
Create branch git checkout -b feature/name
Push code git push origin feature/name
Create MR git push origin feature/name -o merge_request.create
View pipeline GitLab UI → CI/CD → Pipelines
Check config GitLab UI → CI/CD → Pipeline Editor
View logs Click on job in pipeline

📝 Document Information

  • Created: November 26, 2025
  • Version: 1.0
  • Total Files: 5
  • Estimated Study Time: 15-25 hours
  • Last Updated: November 26, 2025

🎯 Goals After Course

You Will Be Able To:

  • ✅ Create and manage GitLab projects
  • ✅ Write effective .gitlab-ci.yml files
  • ✅ Build, test, and deploy using CI/CD
  • ✅ Use Docker in pipelines
  • ✅ Deploy to multiple environments
  • ✅ Setup production-ready pipelines
  • ✅ Integrate with external services
  • ✅ Troubleshoot pipeline issues

Career Impact:

  • 📈 DevOps/SRE automation skills
  • 📈 CI/CD pipeline expertise
  • 📈 Cloud deployment knowledge
  • 📈 Better job opportunities

Ready to master GitLab CI/CD? Let's get started! 🚀

Start with 01-gitlab-ci-basics.md and follow the learning path that matches your goals.

Happy coding! 💻

Комментарии (0)

Для добавления комментария необходимо войти в аккаунт

Войти / Зарегистрироваться