Package convert provides tooling to convert third party pipeline configurations to the Harness pipeline configuration format.
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)
}
Command Line
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.
Compile the binary:
git clone https://github.com/drone/go-convert.git
cd go-convert
go build
Bitbucket
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 compatble with bat for syntax highlight.
./go-convert bitbucket --before-after samples/bitbucket.yaml | bat -l yaml