π Convert third-party CI/CD pipelines and Harness v0 YAML to Harness v1 format
Go Convert provides comprehensive tooling to convert CI/CD pipeline configurations to the Harness pipeline format. It supports multiple platforms and offers flexible deployment options for different use cases.
- β Multi-Platform Support: Bitbucket, Drone, GitLab, Jenkins β Harness
- β v0 to v1 Migration: Convert Harness legacy format to modern v1
- β Batch Processing: Convert up to 100 items in a single API call
- β Template Reference Mapping: Update nested template references during conversion
- β Three Deployment Modes: Library, CLI, or HTTP Microservice
- β Production Ready: Docker support, graceful shutdown, health checks
| Mode | Best For | Quick Start |
|---|---|---|
| π Go Library | Embedded in Go applications | import "github.com/drone/go-convert" |
| π₯οΈ Command Line | Local development & debugging | ./go-convert bitbucket pipeline.yml |
| π HTTP Microservice β | Language-agnostic API access | ./scripts/start-service.sh |
- HTTP Microservice β NEW
- Go Library Usage
- Command Line Tools
- Microservice Deployment
- API Examples
- Development
- IDE Integration
- Contributing
New in this release! Convert Harness v0 YAML (pipelines, templates, input sets) to v1 format via REST API with batch processing and template reference mapping support.
βββββββββββββββββββ
β Client App β
β (Any Language) β
ββββββββββ¬βββββββββ
β HTTP/JSON
βΌ
βββββββββββββββββββββββββββββββββββ
β Go Convert Microservice β
β ββββββββββββββββββββββββββββββ β
β β POST /api/v1/convert/batchβ β
β β - Pipelines β β
β β - Templates β β
β β - Input Sets β β
β β - Template Ref Mapping β β
β ββββββββββββββββββββββββββββββ β
ββββββββββ¬βββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββ
β Conversion Engine β
β - v0 β v1 Pipeline Converter β
β - Template Converter β
β - Input Set Converter β
β - Reference Replacer β
βββββββββββββββββββββββββββββββββββ
# Start the service
./scripts/start-service.sh
# Or using Make
make run
# Or using Docker
./scripts/start-docker.shService starts on http://localhost:8090
GET /healthz- Health checkPOST /api/v1/convert/batch- Batch convert pipelines, templates, and input sets
curl -X POST http://localhost:8090/api/v1/convert/batch \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"id": "pipeline-1",
"entity_type": "pipeline",
"yaml": "<v0 pipeline YAML>",
"entity_ref_mapping": {
"oldTemplateRef": "newTemplateRef_v1"
}
},
{
"id": "template-1",
"entity_type": "template",
"yaml": "<v0 template YAML>"
}
]
}'β
Batch Processing: Convert up to 100 items per request
β
Multi-Entity Support: Pipelines, templates (Pipeline/Stage/Step), and input sets
β
Template Reference Mapping: Update nested template references during conversion
β
Integrity Verification: SHA-256 checksums for all conversions
β
Production Ready: Structured logging, graceful shutdown, health checks
β
Container Ready: Docker and Kubernetes support
β
Language Agnostic: REST API accessible from any language
| Use Case | Recommended Mode | Why? |
|---|---|---|
| Integrate into Go application | π Library | Direct function calls, type safety |
| Quick local conversion | π₯οΈ CLI | Simple, no setup required |
| Production API service | π Microservice | Scalable, language-agnostic |
| Batch migrations | π Microservice | Process 100s of files efficiently |
| CI/CD pipeline integration | π Microservice | REST API, easy integration |
| Development & debugging | π₯οΈ CLI | Fast iteration, syntax highlighting |
- QUICKSTART.md - Get the service running in 30 seconds
- SERVICE.md - Complete API documentation and deployment guide
- TECH_SPEC.md - Architecture and design details
| Environment Variable | Default | Description |
|---|---|---|
PORT |
8090 | HTTP listen port |
LOG_LEVEL |
debug | Logging level (debug/info/warn/error) |
MAX_BATCH_SIZE |
100 | Maximum items per batch request |
MAX_YAML_BYTES |
1048576 | Maximum request body size (1MB) |
- π Lightweight: ~10MB binary, minimal memory footprint
- β‘ Fast: Converts typical pipeline in <100ms
- π¦ Batch Optimized: Process up to 100 items per request
- π Stateless: Easily scale horizontally
- π³ Container Ready: Small distroless Docker image (~20MB)
Bitbucket Pipelines βββ
Drone CI βββ€
GitLab CI βββΌβββ€ Harness v1 Pipeline
Jenkins βββ€
GitHub Actions βββ
Harness v0 Pipeline βββ€ Harness v1 Pipeline
Harness v0 Template βββ€ Harness v1 Template (Pipeline/Stage/Step)
Harness v0 InputSet βββ€ Harness v1 InputSet
Special Features:
- π Template reference mapping during conversion
- β Validates converted YAML structure
- π Generates SHA-256 checksums
Sample Usage
Sample code to convert a Bitbucket pipeline to a Harness pipeline:
import "github.com/drone/go-convert/convert/bitbucket"converter := bitbucket.New(
bitbucket.WithDockerhub(c.dockerConn),
bitbucket.WithKubernetes(c.kubeConn, c.kubeName),
)
converted, err := converter.ConvertFile("bitbucket-pipelines.yml")
if err != nil {
log.Fatalln(err)
}This package provides command line tools for local development and debugging purposes. These command line tools are intentionally simple. For more robust command line tooling please use the harness-convert project.
git clone https://github.com/drone/go-convert.git
cd go-convert
go buildBitbucket
Convert a Bitbucket pipeline:
./go-convert bitbucket samples/bitbucket.yaml
Convert a Gitlab pipeline and print the before after:
./go-convert bitbucket --before-after samples/bitbucket.yaml
Convert a Bitbucket pipeline and downgrade to the Harness v0 format:
./go-convert bitbucket --downgrade samples/bitbucket.yaml
Drone
Convert a Drone pipeline:
./go-convert drone samples/drone.yaml
Convert a Drone pipeline and print the before after:
./go-convert drone --before-after samples/drone.yaml
Convert a Drone pipeline and downgrade to the Harness v0 format:
./go-convert drone --downgrade samples/drone.yaml
Gitlab
Convert a Gitlab pipeline:
./go-convert gitlab samples/gitlab.yaml
Convert a Gitlab pipeline and print the before after:
./go-convert gitlab --before-after samples/gitlab.yaml
Convert a Gitlab pipeline and downgrade to the Harness v0 format:
./go-convert gitlab --downgrade samples/gitlab.yaml
Jenkins
Convert a Jenkinsfile:
./go-convert jenkins --token=<chat-gpt-token> samples/Jenkinsfile
Convert a Jenkinsfile and downgrade to the Harness v0 format:
./go-convert jenkins --token=<chat-gpt-token> --downgrade samples/Jenkinsfile
Syntax Highlighting
The command line tools are compatible with bat for syntax highlight.
./go-convert bitbucket --before-after samples/bitbucket.yaml | bat -l yaml
# Using scripts
./scripts/start-service.sh
# Using Makefile
make run-debug
# With custom configuration
PORT=9000 LOG_LEVEL=info make run# Build image
make docker-build
# Run container
docker run -p 8090:8090 go-convert-service:latest
# Or use the script
./scripts/start-docker.shapiVersion: apps/v1
kind: Deployment
metadata:
name: go-convert-service
spec:
replicas: 3
selector:
matchLabels:
app: go-convert-service
template:
metadata:
labels:
app: go-convert-service
spec:
containers:
- name: go-convert-service
image: go-convert-service:latest
ports:
- containerPort: 8090
env:
- name: LOG_LEVEL
value: "info"
livenessProbe:
httpGet:
path: /healthz
port: 8090
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe:
httpGet:
path: /healthz
port: 8090
initialDelaySeconds: 3
periodSeconds: 5See SERVICE.md for complete deployment documentation.
go-convert/
βββ cmd/
β βββ server/ # HTTP microservice entrypoint
βββ convert/ # Conversion logic for various CI/CD platforms
β βββ bitbucket/ # Bitbucket pipelines converter
β βββ drone/ # Drone pipelines converter
β βββ gitlab/ # Gitlab CI converter
β βββ jenkins/ # Jenkins converter
β βββ v0tov1/ # Harness v0 to v1 converter
βββ service/ # HTTP service implementation
β βββ converter/ # v0βv1 conversion handlers
β β βββ pipeline.go # Pipeline conversion
β β βββ template.go # Template conversion (Pipeline/Stage/Step)
β β βββ inputset.go # Input set conversion
β β βββ template_refs.go # Template reference replacement
β βββ handler.go # HTTP request handlers
β βββ server.go # HTTP server and middleware
β βββ request.go # Request/response types
βββ scripts/ # Launch scripts
β βββ start-service.sh
β βββ start-docker.sh
β βββ stop-service.sh
βββ .vscode/ # VS Code launch configurations
βββ .idea/ # IntelliJ run configurations
βββ Dockerfile.service # Docker build configuration
βββ Makefile # Build and run automation
βββ QUICKSTART.md # Quick start guide
βββ SERVICE.md # Service documentation
βββ TECH_SPEC.md # Technical specification
# Build CLI tool
go build -o go-convert
# Build microservice
go build -o go-convert-service ./cmd/server
# Or use Makefile
make build# Run tests
go test ./...
# With coverage
make test-coveragemake fmt# Install air: make install-tools
make dev- Open project in VS Code
- Press
F5to start debugging - Select "Launch go-convert Service"
Available configurations:
- Launch go-convert Service (port 8090)
- Launch go-convert Service (Custom Port 9000)
- Attach to running service
- Open run configurations dropdown
- Select "Go Convert Service"
- Click Run (
βΆοΈ ) or Debug (π)
Available configurations:
- Go Convert Service
- Go Convert Service (Port 9000)
- Docker: Go Convert Service
curl http://localhost:8090/healthz
# Response: {"status":"ok"}curl -X POST http://localhost:8090/api/v1/convert/batch \
-H "Content-Type: application/json" \
-d '{
"items": [{
"id": "pipeline-1",
"entity_type": "pipeline",
"yaml": "pipeline:\n identifier: test\n name: Test Pipeline\n stages: []"
}]
}'curl -X POST http://localhost:8090/api/v1/convert/batch \
-H "Content-Type: application/json" \
-d '{
"items": [{
"id": "template-1",
"entity_type": "template",
"yaml": "template:\n type: Stage\n spec: {...}",
"entity_ref_mapping": {
"oldRef": "newRef_v1"
}
}]
}'curl -X POST http://localhost:8090/api/v1/convert/batch \
-H "Content-Type: application/json" \
-d @test_batch_with_mapping.jsonRun make help to see all available commands:
| Command | Description |
|---|---|
make help |
Show all available commands |
make build |
Build the service binary |
make run |
Build and run locally |
make run-debug |
Run with debug logging |
make test |
Run tests |
make test-coverage |
Run tests with coverage |
make docker-build |
Build Docker image |
make docker-run |
Run in Docker (background) |
make docker-stop |
Stop Docker container |
make health-check |
Check service health |
make example-request |
Send example request |
make clean |
Remove build artifacts |
Port Already in Use
# Find what's using the port
lsof -i :8090
# Kill the process
kill -9 <PID>
# Or use a different port
PORT=9000 ./scripts/start-service.shService Not Responding
# Check if service is running
curl http://localhost:8090/healthz
# Check logs (if running in Docker)
docker logs go-convert-service
# Restart the service
./scripts/stop-service.sh
./scripts/start-service.shDocker Build Fails
# Clean Docker cache
docker system prune -a
# Rebuild
make docker-buildModule Dependencies Issues
# Download dependencies
make mod-download
# Tidy dependencies
make mod-tidy
# Rebuild
make clean build./scripts/start-service.sh # Local
./scripts/start-docker.sh # Docker
make run # Using Makecurl localhost:8090/healthz # Health check
make example-request # Send test requestmake build # Build binary
make test # Run tests
make docker-build # Build Docker image- QUICKSTART.md - Get started in 30 seconds
- SERVICE.md - Complete API documentation
- TECH_SPEC.md - Architecture details
- API Endpoint:
http://localhost:8090/api/v1/convert/batch - Health Check:
http://localhost:8090/healthz - Test Files:
test_batch_request.json,test_batch_with_mapping.json
We welcome contributions! Here's how:
- Fork the repository
- Create your feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Test your changes
make test make fmt - Commit your changes
git commit -m 'Add amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Write tests for new features
- Follow existing code style (run
make fmt) - Update documentation as needed
- Ensure all tests pass (
make test)
- harness-convert - Production-grade CLI tool
- Harness Platform - https://harness.io
Apache 2.0 - See LICENSE file for details.
- Quick Start: QUICKSTART.md
- Service Guide: SERVICE.md
- Technical Spec: TECH_SPEC.md
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
For production-grade command line tooling, use harness-convert.
Made with β€οΈ by the Harness Team
Documentation β’ Quick Start β’ Technical Spec