transform

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 6 Imported by: 0

README

Woodpecker CI pipeline transform

status-badge Go Reference

Go library and utility to convert different pipelines to Woodpecker CI pipeline(s).

Currently supports converting only from Drone CI pipeline format with limited functionality.

Drone CI pipeline supported features

  • kind - must be pipeline
  • type - only docker and exec are supported
  • name
  • platform
    • os
    • arch
    • version - not supported by Woodpecker CI
  • node
  • trigger
    • branch
    • event
    • refs
    • repo
    • status
    • target - not supported by Woodpecker CI
    • cron
    • action - not supported by Woodpecker CI
  • workspace
    • path
  • services
    • name
    • image
    • pull
    • privileged
    • environment - including from_secret
    • entrypoint
    • commands
    • volumes
      • name
      • path
  • clone
    • disable
    • depth
  • steps
    • name
    • image
    • pull
    • settings
    • detach
    • privileged
    • failure - not supported by Woodpecker CI
    • environment - including from_secret
    • commands
    • volumes
      • name
      • path
    • when
      • branch
      • event - cron, custom, push, pull_request, tag and promote are supported. Other events are not supported by Woodpecker CI
      • refs
      • repo
      • instance - only single instance condition is supported by Woodpecker CI
      • status
      • target - only single environment condition is supported by Woodpecker CI
      • cron
    • depends_on - not supported by Woodpecker CI
  • depends_on
  • volumes
    • name
    • host
    • temp - not supported by Woodpecker CI

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("unsupported pipeline")

Functions

func FormatWoodpeckerYAML added in v0.1.0

func FormatWoodpeckerYAML(data []byte) ([]byte, error)

FormatWoodpeckerYAML add newlines so that the pipeline YAML is easier to read.

Types

type Clone added in v0.1.0

type Clone struct {
	Git *CloneStep `yaml:"git,omitempty" json:"git,omitempty"`
	Hg  *CloneStep `yaml:"hg,omitempty"  json:"hg,omitempty"`
}

type CloneStep added in v0.1.0

type CloneStep struct {
	Image    string   `yaml:"image,omitempty"    json:"image,omitempty"`
	Settings Settings `yaml:"settings,omitempty" json:"settings,omitempty"`
}

type Conditions added in v0.1.0

type Conditions struct {
	Conditions []string `yaml:"-"                 json:"-"`
	Include    []string `yaml:"include,omitempty" json:"include,omitempty"`
	Exclude    []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`
}

func (*Conditions) IsEmpty added in v0.1.0

func (c *Conditions) IsEmpty() bool

func (Conditions) MarshalYAML added in v0.1.0

func (c Conditions) MarshalYAML() (interface{}, error)

type PathConditions added in v0.1.0

type PathConditions struct {
	Conditions    []string `yaml:"-"                        json:"-"`
	Include       []string `yaml:"include,omitempty"        json:"include,omitempty"`
	Exclude       []string `yaml:"exclude,omitempty"        json:"exclude,omitempty"`
	IgnoreMessage string   `yaml:"ignore_message,omitempty" json:"ignore_message,omitempty"`
}

func (*PathConditions) IsEmpty added in v0.1.0

func (c *PathConditions) IsEmpty() bool

func (PathConditions) MarshalYAML added in v0.1.0

func (c PathConditions) MarshalYAML() (interface{}, error)

type Pipeline

type Pipeline struct {
	Name      string            `yaml:"-"                     json:"-"`
	Platform  string            `yaml:"platform,omitempty"    json:"platform,omitempty"`
	Labels    map[string]string `yaml:"labels,omitempty"      json:"labels,omitempty"`
	RunsOn    []string          `yaml:"runs_on,omitempty"     json:"runs_on,omitempty"`
	DependsOn []string          `yaml:"depends_on,omitempty"  json:"depends_on,omitempty"`
	Services  Services          `yaml:"services,omitempty"    json:"services,omitempty"`
	Workspace *Workspace        `yaml:"workspace,omitempty"   json:"workspace,omitempty"`
	SkipClone bool              `yaml:"skip_clone,omitempty"  json:"skip_clone,omitempty"`
	Clone     *Clone            `yaml:"clone,omitempty"       json:"clone,omitempty"`
	Steps     Steps             `yaml:"steps"                 json:"steps"`
	When      *When             `yaml:"when,omitempty"        json:"when,omitempty"`
}

type Secret added in v0.1.0

type Secret struct {
	Source string `yaml:"source"`
	Target string `yaml:"target"`
}

type Secrets added in v0.1.0

type Secrets []Secret

func (Secrets) MarshalYAML added in v0.1.0

func (s Secrets) MarshalYAML() (interface{}, error)

type Service added in v0.1.0

type Service struct {
	Name        string   `yaml:"-"                     json:"-"`
	Image       string   `yaml:"image"                 json:"image"`
	Pull        bool     `yaml:"pull,omitempty"        json:"pull,omitempty"`
	Environment []string `yaml:"environment,omitempty" json:"environment,omitempty"`
	Secrets     Secrets  `yaml:"secrets,omitempty"     json:"secrets,omitempty"`
	Commands    []string `yaml:"commands,omitempty"    json:"commands,omitempty"`
	Settings    Settings `yaml:"settings,omitempty"    json:"settings,omitempty"`
	Privileged  bool     `yaml:"privileged,omitempty"  json:"privileged,omitempty"`
	Volumes     []string `yaml:"volumes,omitempty"     json:"volumes,omitempty"`
	When        *When    `yaml:"when,omitempty"        json:"when,omitempty"`
}

type Services added in v0.1.0

type Services []*Service

func (Services) MarshalYAML added in v0.1.0

func (s Services) MarshalYAML() (interface{}, error)

type Setting added in v0.1.0

type Setting struct {
	Name  string
	Value interface{}
}

type Settings added in v0.1.0

type Settings []Setting

func (Settings) MarshalYAML added in v0.1.0

func (s Settings) MarshalYAML() (interface{}, error)

func (*Settings) UnmarshalYAML added in v0.1.0

func (s *Settings) UnmarshalYAML(unmarshal func(interface{}) error) error

type Source

type Source struct {
	Name    string
	Content []byte
}

type Step

type Step struct {
	Name        string   `yaml:"name"`
	Image       string   `yaml:"image,omitempty"       json:"image,omitempty"`
	Pull        bool     `yaml:"pull,omitempty"        json:"pull,omitempty"`
	Environment []string `yaml:"environment,omitempty" json:"environment,omitempty"`
	Secrets     Secrets  `yaml:"secrets,omitempty"     json:"secrets,omitempty"`
	Commands    []string `yaml:"commands,omitempty"    json:"commands,omitempty"`
	Settings    Settings `yaml:"settings,omitempty"    json:"settings,omitempty"`
	Detach      bool     `yaml:"detach,omitempty"      json:"detach,omitempty"`
	Privileged  bool     `yaml:"privileged,omitempty"  json:"privileged,omitempty"`
	Volumes     []string `yaml:"volumes,omitempty"     json:"volumes,omitempty"`
	When        *When    `yaml:"when,omitempty"        json:"when,omitempty"`
}

type Steps

type Steps []*Step

type Transformer

type Transformer interface {
	Transform([]*Source) ([]*Pipeline, error)
	PostProcess([]byte) ([]byte, error)
}

type When added in v0.1.0

type When struct {
	Repo        *Conditions       `yaml:"repo,omitempty"        json:"repo,omitempty"`
	Branch      *Conditions       `yaml:"branch,omitempty"      json:"branch,omitempty"`
	Event       *Conditions       `yaml:"event,omitempty"       json:"event,omitempty"`
	Ref         *Conditions       `yaml:"ref,omitempty"         json:"ref,omitempty"`
	Status      []string          `yaml:"status,omitempty"      json:"status,omitempty"`
	Platform    core.Strings      `yaml:"platform,omitempty"    json:"platform,omitempty"`
	Environment string            `yaml:"environment,omitempty" json:"environment,omitempty"`
	Matrix      map[string]string `yaml:"matrix,omitempty"      json:"matrix,omitempty"`
	Instance    string            `yaml:"instance,omitempty"    json:"instance,omitempty"`
	Path        *PathConditions   `yaml:"path,omitempty"        json:"path,omitempty"`
	Cron        *Conditions       `yaml:"cron,omitempty"        json:"cron,omitempty"`
}

func (When) IsEmpty added in v0.1.0

func (s When) IsEmpty() bool

type Workspace

type Workspace struct {
	Base string `yaml:"base" json:"base"`
	Path string `yaml:"path" json:"path"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL