drone-gitlab-ci

繁體中文 | 简体中文 | English

What is drone-gitlab-ci?
drone-gitlab-ci is a CLI tool and CI/CD plugin that triggers GitLab CI pipelines from any environment. It serves as a bridge between different CI/CD platforms, enabling you to integrate GitLab CI into your existing workflows seamlessly.
Why use this?
In modern software development, teams often use multiple CI/CD platforms across different projects or services. This creates challenges when you need to:
- Cross-Platform Integration: Trigger GitLab CI pipelines from other CI/CD systems (Drone, GitHub Actions, Jenkins, etc.)
- Microservices Orchestration: Automatically trigger dependent service pipelines after deployment
- Unified Pipeline Management: Centralize pipeline triggering logic across diverse infrastructure
- Hybrid Cloud Workflows: Connect CI/CD processes across different platforms and environments
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Drone CI │ │ │ │ │
│ GitHub Actions│────▶│ drone-gitlab-ci │────▶│ GitLab CI │
│ Jenkins │ │ │ │ Pipeline │
│ Local Dev │ └──────────────────┘ └─────────────────┘
└─────────────────┘
Use Cases
| Scenario |
Description |
| Drone CI → GitLab CI |
Use as a Drone plugin to trigger GitLab pipelines after Drone builds |
| GitHub Actions → GitLab CI |
Trigger GitLab deployments from GitHub repositories |
| Jenkins → GitLab CI |
Integrate GitLab CI into existing Jenkins workflows |
| Local Development |
Manually trigger pipelines during development and testing |
| Microservices |
Service A deployment triggers Service B pipeline automatically |
Features
- Trigger GitLab CI pipelines via API
- Pass custom variables to pipelines
- Wait for pipeline completion with configurable timeout
- Support for self-hosted GitLab instances
- Cross-platform binary (Windows, Linux, macOS)
- Docker image available
- Native support for Drone CI, GitHub Actions, and other CI/CD platforms
Table of Contents
Quick Start
Trigger a GitLab CI pipeline in 3 steps:
# 1. Download the binary (or use Docker)
go install github.com/appleboy/drone-gitlab-ci@latest
# 2. Set your credentials
export GITLAB_TOKEN=your-gitlab-token
export GITLAB_PROJECT_ID=your-project-id
# 3. Trigger the pipeline
drone-gitlab-ci --ref main
Installation
Download Pre-built Binaries
Download from the release page. Supported platforms:
- Windows (amd64/386)
- Linux (amd64/386)
- macOS (amd64/arm64)
Install with Go
go install github.com/appleboy/drone-gitlab-ci@latest
Build from Source
git clone https://github.com/appleboy/drone-gitlab-ci.git
cd drone-gitlab-ci
make build
Configuration
GitLab Setup
1. Create a Personal Access Token
You need a GitLab token to authenticate API requests. See GitLab Token Overview.
- Go to GitLab → User Settings → Access Tokens
- Create a token with
api scope
- Save the token securely

2. Get Your Project ID
Find your project ID in Settings → General → General project settings.

For more details, see Pipeline trigger tokens API.
Parameters
| Parameter |
Flag |
Environment Variables |
Description |
Required |
Default |
| Host |
--host |
GITLAB_HOST, PLUGIN_HOST, INPUT_HOST |
GitLab instance URL |
No |
https://gitlab.com |
| Token |
--token, -t |
GITLAB_TOKEN, PLUGIN_TOKEN, INPUT_TOKEN |
GitLab access token |
Yes |
- |
| Project ID |
--project-id, -p |
GITLAB_PROJECT_ID, PLUGIN_ID, INPUT_PROJECT_ID |
GitLab project ID |
Yes |
- |
| Ref |
--ref, -r |
GITLAB_REF, PLUGIN_REF, INPUT_REF |
Branch or tag to trigger |
No |
main |
| Variables |
--variables |
GITLAB_VARIABLES, PLUGIN_VARIABLES, INPUT_VARIABLES |
Variables to pass (KEY=VALUE) |
No |
- |
| Wait |
--wait, -w |
GITLAB_WAIT, PLUGIN_WAIT, INPUT_WAIT |
Wait for pipeline completion |
No |
false |
| Timeout |
--timeout |
GITLAB_TIMEOUT, PLUGIN_TIMEOUT, INPUT_TIMEOUT |
Timeout for waiting |
No |
60m |
| Interval |
--interval, -i |
GITLAB_INTERVAL, PLUGIN_INTERVAL, INPUT_INTERVAL |
Polling interval |
No |
5s |
| Insecure |
--insecure, -k |
GITLAB_INSECURE, PLUGIN_INSECURE, INPUT_INSECURE |
Skip SSL verification |
No |
false |
| Debug |
--debug, -d |
GITLAB_DEBUG, PLUGIN_DEBUG, INPUT_DEBUG |
Enable debug output |
No |
false |
| GitHub |
--github |
GITHUB_ACTIONS, PLUGIN_GITHUB, INPUT_GITHUB |
Enable GitHub Actions output |
No |
false |
Usage
Command Line
Basic usage:
drone-gitlab-ci \
--host https://gitlab.com \
--token your-token \
--project-id 12345 \
--ref main
With variables and wait for completion:
drone-gitlab-ci \
--host https://gitlab.com \
--token your-token \
--project-id 12345 \
--ref main \
--variables "DEPLOY_ENV=production" \
--variables "VERSION=1.0.0" \
--wait \
--timeout 30m
Enable debug mode:
drone-gitlab-ci \
--host https://gitlab.com \
--token your-token \
--project-id 12345 \
--ref main \
--debug
Docker
Basic usage:
docker run --rm \
-e GITLAB_HOST=https://gitlab.com \
-e GITLAB_TOKEN=your-token \
-e GITLAB_PROJECT_ID=12345 \
-e GITLAB_REF=main \
appleboy/drone-gitlab-ci
With wait and debug:
docker run --rm \
-e GITLAB_HOST=https://gitlab.com \
-e GITLAB_TOKEN=your-token \
-e GITLAB_PROJECT_ID=12345 \
-e GITLAB_REF=main \
-e GITLAB_WAIT=true \
-e GITLAB_DEBUG=true \
appleboy/drone-gitlab-ci
Drone CI
Add to your .drone.yml:
kind: pipeline
name: default
steps:
- name: trigger-gitlab
image: appleboy/drone-gitlab-ci
settings:
host: https://gitlab.com
token:
from_secret: gitlab_token
project_id: 12345
ref: main
wait: true
timeout: 30m
variables:
- DEPLOY_ENV=production
- VERSION=${DRONE_TAG}
GitHub Actions
Create .github/workflows/trigger-gitlab.yml:
name: Trigger GitLab CI
on:
push:
branches: [main]
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger GitLab Pipeline
uses: docker://appleboy/drone-gitlab-ci
with:
host: https://gitlab.com
token: ${{ secrets.GITLAB_TOKEN }}
project_id: 12345
ref: main
github: true
wait: true
Development
Run Tests
make test
Build Binary
make build
Code Quality
make lint
License
MIT License - see LICENSE file for details.