Files
TimeTracker/docs/cicd/PIPELINE_CLEANUP_PLAN.md
2025-10-09 13:48:03 +02:00

8.0 KiB

Pipeline Cleanup Plan

🎯 Objective

Remove redundant workflows and keep only the necessary ones for an efficient CI/CD pipeline.


📊 Current State Analysis

Existing Workflows (7 total)

Workflow Purpose Status Action
ci-comprehensive.yml Complete CI with multi-level testing NEW KEEP
cd-development.yml Automated development builds NEW KEEP
cd-release.yml Automated production releases NEW KEEP
migration-check.yml Database migration validation Specialized KEEP
static.yml CodeQL security scanning Specialized KEEP
ci.yml Basic CI (migrations + Docker) ⚠️ Redundant REMOVE
docker-publish.yml Docker publishing ⚠️ Redundant REMOVE

🔍 Redundancy Analysis

ci.yml (REDUNDANT)

What it does:

  • Tests database migrations (PostgreSQL + SQLite)
  • Tests Docker build
  • Basic security scanning

Why it's redundant:

  • ci-comprehensive.yml includes all migration tests
  • ci-comprehensive.yml includes Docker build tests
  • ci-comprehensive.yml includes security scanning
  • migration-check.yml provides specialized migration validation

Conclusion: Completely covered by new workflows

docker-publish.yml (REDUNDANT)

What it does:

  • Builds Docker images
  • Publishes to GitHub Container Registry
  • Tags images based on events

Why it's redundant:

  • cd-development.yml builds and publishes dev images
  • cd-release.yml builds and publishes release images
  • Both handle multi-platform builds
  • Both handle proper tagging

Conclusion: Completely covered by new workflows


Final Workflows (5 total)

1. CI - Comprehensive Testing (ci-comprehensive.yml)

Purpose: Complete testing on PRs and develop branch
Triggers: PR to main/develop, push to develop
Features:

  • Multi-level testing (smoke, unit, integration, security, database)
  • Parallel execution
  • Code quality checks
  • Security scanning
  • Docker build validation
  • PR comments with results

2. CD - Development Builds (cd-development.yml)

Purpose: Automated development builds
Triggers: Push to develop, manual
Features:

  • Quick test suite
  • Multi-platform Docker builds
  • Publish to GHCR with develop tag
  • Development releases
  • Deployment manifests

3. CD - Production Releases (cd-release.yml)

Purpose: Automated production releases
Triggers: Push to main, version tags, releases, manual
Features:

  • Full test suite
  • Security audit
  • Semantic versioning
  • Multi-platform builds
  • Multiple tags (latest, stable, version)
  • GitHub releases with manifests

4. Migration Validation (migration-check.yml)

Purpose: Specialized database migration validation
Triggers: PR with model/migration changes
Features:

  • Migration consistency checks
  • Rollback safety testing
  • Data integrity verification
  • PR comments with results
  • Specialized for database changes only

5. Static Analysis (static.yml)

Purpose: CodeQL security scanning
Triggers: PR, push, schedule
Features:

  • Advanced code scanning
  • Vulnerability detection
  • GitHub Security integration
  • Scheduled scans

🗑️ Workflows to Remove

ci.yml

Reason: Fully replaced by ci-comprehensive.yml
Action: Delete file

docker-publish.yml

Reason: Fully replaced by cd-development.yml and cd-release.yml
Action: Delete file


📋 Cleanup Steps

Step 1: Backup (Optional)

Create backup of workflows before deletion:

mkdir -p .github/workflows-archive
cp .github/workflows/ci.yml .github/workflows-archive/
cp .github/workflows/docker-publish.yml .github/workflows-archive/

Step 2: Delete Redundant Workflows

# Remove redundant CI workflow
rm .github/workflows/ci.yml

# Remove redundant Docker publish workflow
rm .github/workflows/docker-publish.yml

Step 3: Commit Changes

git add .github/workflows/
git commit -m "chore: Remove redundant CI/CD workflows

- Remove ci.yml (replaced by ci-comprehensive.yml)
- Remove docker-publish.yml (replaced by cd-development.yml and cd-release.yml)
- Keep 5 essential workflows for streamlined CI/CD"

Step 4: Update Documentation

Update any documentation that references removed workflows.


📈 Before vs After

Before Cleanup

  • 7 workflows
  • Redundant testing (same tests in multiple workflows)
  • Overlapping Docker builds
  • Confusing workflow selection
  • Longer total CI time (redundant jobs)

After Cleanup

  • 5 workflows
  • No redundancy
  • Clear separation of concerns
  • Optimized CI time
  • Easier to maintain

🎯 Benefits of Cleanup

1. Reduced Complexity

  • Fewer workflows to maintain
  • Clear purpose for each workflow
  • Easier onboarding for new contributors

2. Faster CI/CD

  • No redundant jobs
  • Optimized execution paths
  • Better resource usage

3. Clearer Workflow Selection

  • PRs → ci-comprehensive.yml
  • Develop builds → cd-development.yml
  • Production releases → cd-release.yml
  • Migration changes → migration-check.yml (automatic)
  • Security scanning → static.yml (automatic)

4. Better Resource Usage

  • Fewer GitHub Actions minutes consumed
  • No duplicate builds
  • More efficient parallel execution

5. Easier Troubleshooting

  • Clear workflow responsibilities
  • No confusion about which workflow runs when
  • Easier to debug issues

⚠️ Important Notes

What Gets Removed

  • ci.yml - Old basic CI
  • docker-publish.yml - Old Docker publishing

What Gets Kept

  • ci-comprehensive.yml - All PR and develop testing
  • cd-development.yml - Development builds and publishing
  • cd-release.yml - Production releases and publishing
  • migration-check.yml - Specialized migration validation
  • static.yml - CodeQL security scanning

No Functionality Lost

All functionality from removed workflows is preserved in the new workflows:

  • All tests still run
  • Docker builds still happen
  • Images still published
  • Releases still created
  • Security scanning still active

🔄 Workflow Triggers After Cleanup

On Pull Request

  • ci-comprehensive.yml - Full testing
  • migration-check.yml - If model/migration changes
  • static.yml - Security scanning

On Push to Develop

  • ci-comprehensive.yml - Testing
  • cd-development.yml - Build and publish

On Push to Main

  • cd-release.yml - Full release pipeline

On Version Tag

  • cd-release.yml - Versioned release

Verification After Cleanup

1. Check Workflows List

ls .github/workflows/
# Should show only 5 files

2. Create Test PR

git checkout -b test-cleanup
git push origin test-cleanup
# Should trigger ci-comprehensive.yml only

3. Push to Develop

git checkout develop
git push origin develop
# Should trigger ci-comprehensive.yml and cd-development.yml

4. Verify No Broken References

# Check documentation for references to removed workflows
grep -r "ci.yml" docs/
grep -r "docker-publish.yml" docs/
# Update any references found

📚 Documentation Updates Needed

After cleanup, update these files:

  1. GITHUB_ACTIONS_SETUP.md - Update workflow list
  2. GITHUB_ACTIONS_VERIFICATION.md - Update workflow count
  3. CI_CD_DOCUMENTATION.md - Update workflow descriptions
  4. BADGES.md - Remove badges for deleted workflows (if any)
  5. README.md - Update CI/CD section

🎉 Summary

Workflows to Remove: 2
Workflows to Keep: 5
Functionality Lost: 0
Benefits: Faster, cleaner, more maintainable
Risk: None (all functionality preserved)

Action: Proceed with cleanup!


Status: Ready to Execute
Impact: Low (redundant workflows only)
Risk Level: Minimal
Recommended: YES