migrate

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunnerMap = map[string]string{
	"ubuntu-latest":  "Linux-Large",
	"ubuntu-24.04":   "Linux-Large",
	"ubuntu-22.04":   "Linux-Large",
	"ubuntu-20.04":   "Linux-Large",
	"macos-latest":   "Mac-Medium",
	"macos-15":       "Mac-Medium",
	"macos-14":       "Mac-Medium",
	"macos-13":       "Mac-Medium",
	"windows-latest": "Windows-Medium",
	"windows-2022":   "Windows-Medium",
	"windows-2019":   "Windows-Medium",
}

RunnerMap holds the default GHA-label → JetBrains-hosted-agent mapping per the 2026.2 schema enum; overridden by schema- or cloud-derived names when connected.

Functions

func BuildRunnerMap

func BuildRunnerMap(imageNames []string) map[string]string

BuildRunnerMap maps known CI runner labels to the best matching agent name; returns nil when no OS matches.

func CollectManualSetup

func CollectManualSetup(results []*ConversionResult) []string

CollectManualSetup returns the deduplicated union of ManualSetup items across results, preserving first-seen order.

func CollectNeedsReview

func CollectNeedsReview(results []*ConversionResult) []string

CollectNeedsReview returns the deduplicated union of NeedsReview items across results, preserving first-seen order.

func DeduplicateOutputNames

func DeduplicateOutputNames(results []*ConversionResult)

func DetectUnsupported

func DetectUnsupported(dir string) []string

DetectUnsupported returns CI configurations present in the repository that migrate does not convert.

func HasValidationErrors

func HasValidationErrors(results []*ConversionResult) bool

HasValidationErrors reports whether any result has a non-empty ValidationError.

func LookupActionTransformer

func LookupActionTransformer(uses string) (actionTransformer, bool)

func MapBambooExpressions

func MapBambooExpressions(s string) string

MapBambooExpressions rewrites Bamboo `${bamboo.*}` references to TeamCity %param% syntax.

func MapGHAExpressions

func MapGHAExpressions(s string) string

func OutputFileName

func OutputFileName(sourcePath string) string

func SanitizeJobID

func SanitizeJobID(id string) string

SanitizeJobID rewrites every run of characters outside [A-Za-z0-9_] to "_" so the result is a valid job key and dependency reference.

func SortedKeys

func SortedKeys[V any](m map[string]V) []string

func ValidSource

func ValidSource(s SourceCI) bool

Types

type CIConfig

type CIConfig struct {
	Source   SourceCI `json:"source"`
	File     string   `json:"file"`
	Jobs     int      `json:"jobs"`
	Steps    int      `json:"steps"`
	Features []string `json:"features"`
}

func AnalyzeFile

func AnalyzeFile(path string, source SourceCI) (*CIConfig, error)

AnalyzeFile reads a single path and returns its CIConfig, inferring the source from the path when not provided.

func Detect

func Detect(dir string, filterSource SourceCI) ([]CIConfig, error)

type ConversionResult

type ConversionResult struct {
	SourceFile      string   `json:"sourceFile"`
	OutputFile      string   `json:"outputFile"`
	Source          SourceCI `json:"source"`
	YAML            string   `json:"yaml"`
	JobsConverted   int      `json:"jobsConverted"`
	StepsConverted  int      `json:"stepsConverted"`
	Simplified      []string `json:"simplified"`
	NeedsReview     []string `json:"needsReview"`
	ManualSetup     []string `json:"manualSetup"`
	ValidationError string   `json:"validationError,omitempty"`

	Pipeline *Pipeline `json:"-"`
}

func Convert

func Convert(cfg CIConfig, data []byte, opts Options) (*ConversionResult, error)

func NewResult

func NewResult(cfg CIConfig) *ConversionResult

type FilePublication

type FilePublication struct {
	Path            string
	ShareWithJobs   bool
	PublishArtifact bool
}

type Job

type Job struct {
	ID                    string
	Name                  string
	RunsOn                string
	Dependencies          []string
	EnableDependencyCache bool
	Parameters            map[string]string
	Steps                 []Step
	FilesPublication      []FilePublication
}

type MigrateOutput

type MigrateOutput struct {
	Sources []CIConfig          `json:"sources"`
	Results []*ConversionResult `json:"results"`
}

type Options

type Options struct {
	RunnerMap map[string]string
}

func (Options) MapRunner

func (o Options) MapRunner(label string) string

func (Options) ResolveRunner

func (o Options) ResolveRunner(label string) (mapped string, ok bool)

ResolveRunner maps a CI runner label to a TC agent name; ok=false flags labels needing manual setup — "" for hosted labels the server has no image for, "self-hosted" for custom labels.

type Pipeline

type Pipeline struct {
	Comment          string
	Jobs             []Job
	Parameters       map[string]string
	ConfigParameters map[string]string
}

func (*Pipeline) String

func (p *Pipeline) String() string

type ResultStatus

type ResultStatus int
const (
	StatusConverted ResultStatus = iota
	StatusSimplified
	StatusUnsupported
	StatusUnknown
)

type SourceCI

type SourceCI string
const (
	GitHubActions SourceCI = "github-actions"
	Bamboo        SourceCI = "bamboo"
)

func InferSource

func InferSource(path string) SourceCI

InferSource guesses a CI source from a path; returns "" when no heuristic matches.

type Step

type Step struct {
	Name             string
	ScriptContent    string
	WorkingDirectory string
	Parameters       map[string]string
}

type StepResult

type StepResult struct {
	Status                ResultStatus
	Steps                 []Step
	Artifacts             []FilePublication
	EnableDependencyCache bool
	Note                  string
	ManualTasks           []string
}

func Converted

func Converted(steps []Step) StepResult

func Unknown

func Unknown(identifier string, inputs map[string]string) StepResult

Jump to

Keyboard shortcuts

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