azdevops

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package azdevops parses Azure DevOps pipeline YAML files and converts them to workflow.Workflow so the existing runner can execute them.

Index

Constants

This section is empty.

Variables

View Source
var AzureImageMap = map[string]string{
	"ubuntu-latest": "ghcr.io/catthehacker/ubuntu:act-latest",
	"ubuntu-22.04":  "ghcr.io/catthehacker/ubuntu:act-22.04",
	"ubuntu-20.04":  "ghcr.io/catthehacker/ubuntu:act-20.04",
	"ubuntu-18.04":  "ghcr.io/catthehacker/ubuntu:act-18.04",

	"windows-latest": "ghcr.io/catthehacker/ubuntu:act-latest",
	"windows-2022":   "ghcr.io/catthehacker/ubuntu:act-latest",
	"windows-2019":   "ghcr.io/catthehacker/ubuntu:act-latest",
	"macos-latest":   "ghcr.io/catthehacker/ubuntu:act-latest",
	"macos-13":       "ghcr.io/catthehacker/ubuntu:act-latest",
	"macos-12":       "ghcr.io/catthehacker/ubuntu:act-latest",
}

AzureImageMap maps Azure DevOps vmImage labels to Docker images.

Functions

func DiscoverPipelines

func DiscoverPipelines(dir string) ([]*workflow.Workflow, error)

DiscoverPipelines finds azure-pipelines.yml / azure-pipelines.yaml in dir.

func IsPipelineFile

func IsPipelineFile(path string) bool

IsPipelineFile returns true if path looks like an Azure DevOps pipeline file.

func ParseFile

func ParseFile(path string) (*workflow.Workflow, error)

ParseFile parses an Azure DevOps pipeline YAML file and converts it to a workflow.Workflow that the existing runner can execute unchanged.

Types

type Job

type Job struct {
	Job              string         `yaml:"job"`
	DisplayName      string         `yaml:"displayName"`
	Pool             *Pool          `yaml:"pool"`
	DependsOn        StringOrSlice  `yaml:"dependsOn"`
	Variables        VariablesField `yaml:"variables"`
	Steps            []Step         `yaml:"steps"`
	Condition        string         `yaml:"condition"`
	TimeoutInMinutes int            `yaml:"timeoutInMinutes"`
}

Job represents an Azure DevOps job.

type Pipeline

type Pipeline struct {
	Name      string         `yaml:"name"`
	Trigger   interface{}    `yaml:"trigger"`
	Pool      *Pool          `yaml:"pool"`
	Variables VariablesField `yaml:"variables"`
	Jobs      []Job          `yaml:"jobs"`
	Stages    []Stage        `yaml:"stages"`
	Steps     []Step         `yaml:"steps"` // top-level steps (no explicit job)
}

Pipeline represents a parsed azure-pipelines.yml file.

type Pool

type Pool struct {
	VMImage string
	Name    string
}

Pool represents an Azure DevOps agent pool (string name or vmImage object).

func (*Pool) UnmarshalYAML

func (p *Pool) UnmarshalYAML(node *yaml.Node) error

type Stage

type Stage struct {
	Stage       string        `yaml:"stage"`
	DisplayName string        `yaml:"displayName"`
	DependsOn   StringOrSlice `yaml:"dependsOn"`
	Jobs        []Job         `yaml:"jobs"`
}

Stage represents an Azure DevOps stage.

type Step

type Step struct {
	Script           string            `yaml:"script"`
	Bash             string            `yaml:"bash"`
	PowerShell       string            `yaml:"powershell"`
	Task             string            `yaml:"task"`
	Checkout         string            `yaml:"checkout"`
	DisplayName      string            `yaml:"displayName"`
	Name             string            `yaml:"name"`
	Env              map[string]string `yaml:"env"`
	Inputs           map[string]string `yaml:"inputs"`
	Condition        string            `yaml:"condition"`
	WorkingDirectory string            `yaml:"workingDirectory"`
	ContinueOnError  bool              `yaml:"continueOnError"`
	TimeoutInMinutes int               `yaml:"timeoutInMinutes"`
}

Step represents a single Azure DevOps step.

type StringOrSlice

type StringOrSlice []string

StringOrSlice handles YAML fields that can be a string or []string.

func (*StringOrSlice) UnmarshalYAML

func (s *StringOrSlice) UnmarshalYAML(node *yaml.Node) error

type VariablesField

type VariablesField map[string]string

VariablesField handles Azure DevOps variables as a map or a list of {name, value} objects.

func (*VariablesField) UnmarshalYAML

func (v *VariablesField) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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