⏱ Duration: 5 Hours
📚 Learning Objectives
- Build a complete CI/CD pipeline
- Implement build, test, and deploy stages
- Add quality gates and approvals
- Handle deployment environments
📖 Complete Pipeline Example
name: Complete CI/CD Pipeline
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t myapp:${{ github.sha }} .
- name: Push to registry
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker push myapp:${{ github.sha }}
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
pip install pytest
pytest tests/ -v
deploy-staging:
needs: test
runs-on: ubuntu-latest
environment: staging
steps:
- name: Deploy to staging
run: echo "Deploying to staging..."
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to production
run: echo "Deploying to production..."🔬 Hands-on Lab
Build Your Pipeline
- Create multi-stage pipeline
- Add Docker build and push
- Configure environments
- Test the complete flow