使用GitBlit类版本控制系统,能否保留它同时启用GitLab CI/CD?
Absolutely, this is totally feasible! You don’t have to migrate all your projects to GitLab just to use its powerful CI/CD pipelines—here’s how to set this up while keeping GitBlit as your source of truth:
1. Connect GitLab CI/CD directly to your GitBlit repository
Instead of using the "Import Project" feature (which creates a disconnected copy), you can link GitLab to your existing GitBlit repo for CI/CD:
- Create a blank project in GitLab (no need to import any code here).
- Navigate to Settings > CI/CD > Repository in your GitLab project.
- Under the External repository section, select "Git repository" and enter your GitBlit repo’s URL. Add valid credentials (username/password or SSH key) that have pull access to the GitBlit repo.
- Now, every time your pipeline runs, GitLab will pull the latest code directly from GitBlit—your code stays hosted exclusively in GitBlit, and GitLab only fetches what it needs for builds/tests.
2. Automate pipeline triggers with GitBlit webhooks
To make pipelines run automatically when you push code to GitBlit, set up a webhook:
- In your GitBlit repo’s settings, find the webhooks configuration section.
- Add a new webhook pointing to your GitLab project’s pipeline trigger endpoint. You can get this URL from GitLab under Settings > CI/CD > Pipeline triggers, or use the API format:
https://your-gitlab-instance.com/api/v4/projects/<your-project-id>/trigger/pipeline. - Configure the webhook to trigger on
pushevents—this way, every code push to GitBlit will send a signal to GitLab to kick off a new pipeline with the latest code.
3. Optional: Set up a read-only pull mirror (for backup/browsing)
If you want GitLab to keep a synced copy of your GitBlit repo (for easier browsing or backup, but still push all changes to GitBlit), use a pull mirror:
- In your blank GitLab project, go to Settings > Repository > Mirroring repositories.
- Add your GitBlit repo URL, set the mirror direction to Pull, and toggle on options like "Mirror only protected branches" if needed.
- GitLab will periodically pull updates from GitBlit, and you can run CI/CD against this mirrored repo—though the direct external repo connection is better for immediate pipeline triggers.
This setup lets you test out GitLab CI/CD’s full feature set (runners, artifacts, pipeline dashboards, etc.) without committing to a full migration. Once you’re happy with the workflow, you can decide to migrate projects to GitLab later if you want.
内容的提问来源于stack exchange,提问作者GGO

