gitlab

package
v0.0.0-...-44853c3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WHEN_ON_SUCCESS = "on_success"
	WHEN_ON_FAILURE = "on_failure"
	WHEN_NEVER      = "never"
	WHEN_ALWAYS     = "always"
	WHEN_MANUAL     = "manual"
	WHEN_DELAYED    = "delayed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowFailure

type AllowFailure struct {
	AllowFailure          bool  `default:"false"`
	AllowFailureExitCodes []int `default:"[]"`
}

func (*AllowFailure) Parse

func (a *AllowFailure) Parse(template any) error

type Artifacts

type Artifacts struct {
	Paths    []string `default:"[]"`
	Exclude  []string `default:"[]"`
	ExpireIn string
	ExposeAs string
	Name     string
	Public   bool
	When     string
}

func (*Artifacts) Parse

func (a *Artifacts) Parse(template any) error

type AutoCancel

type AutoCancel struct {
	Commit     string `gitlabci:"on_new_commit"`
	JobFailure string `gitlabci:"on_job_failure"`
}

func (*AutoCancel) Parse

func (ac *AutoCancel) Parse(template any) error

type Cache

type Cache struct {
	Paths []string `default:"[]"`
}

func (*Cache) Parse

func (cache *Cache) Parse(template any) error

type Image

type Image struct {
	Name       string
	EntryPoint []string `default:"[]"`
}

func (*Image) Parse

func (image *Image) Parse(template any) error

type Include

type Include struct {
	File      []string
	Local     string
	Remote    string
	Project   string
	Component string
	Template  string
	Inputs    map[string]string `default:"{}"`
	Ref       string
	Rules     []Rule `default:"[]"`
	// contains filtered or unexported fields
}

func (*Include) GetTemplate

func (include *Include) GetTemplate() ([]map[any]any, error)

func (*Include) Parse

func (include *Include) Parse(template any) error

type Job

type Job struct {
	Name string `json:"name"`

	Image Image `default:"{}" json:"image"`

	Stage string `default:"test" json:"stage"`

	Script       []string `json:"script"`
	BeforeScript []string `default:"[]" gitlabci:"before_script" json:"before_script"`
	AfterScript  []string `default:"[]" gitlabci:"after_script" json:"after_script"`

	When         string   `default:"on_success" json:"on_success"`
	Rules        []Rule   `json:"rules"`
	Needs        Needs    `gitlabci:"needs" json:"needs"`
	Dependencies []string `json:"dependencies"`

	Variables map[string]string `json:"variables"`

	Interruptible bool `json:"interruptible"`

	Extends []string `json:"extends"`

	AllowFailure AllowFailure `gitlabci:"allow_failure" json:"allow_failure"`

	Artifacts Artifacts `json:"artifacts"`
	Cache     Cache     `json:"cache"`

	Coverage string `json:"coverage"`
	// contains filtered or unexported fields
}

func (*Job) Fill

func (job *Job) Fill(pipeline *Pipeline) error

func (Job) GetActiveJob

func (job Job) GetActiveJob(in_variables Variables) (Job, error)

Get a copy of the current job, but overwritten with the first active rule

func (*Job) Parse

func (job *Job) Parse(name string, template map[string]any) error

func (*Job) String

func (job *Job) String() string

type Need

type Need struct {
	Job       string
	Ref       string
	Project   string
	Pipeline  string
	Artifacts bool `default:"true"`
	Optional  bool `default:"false"`
}

func (*Need) Parse

func (need *Need) Parse(template any) error

type Needs

type Needs struct {
	// A list of needs
	Needs []Need

	// Is true when relying on stages to define dependencies
	NoNeeds bool `default:"true"`
}

func (*Needs) Parse

func (needs *Needs) Parse(template any) error

type Pipeline

type Pipeline struct {
	Stages []string `default:"[\"build\", \"test\", \"deploy\"]" json:"stages"`

	Include []Include `default:"[]" json:"include"`

	Jobs map[string]Job `default:"{}" json:"jobs"`

	Variables map[string]string `json:"variables"`

	WorkFlow WorkFlow `json:"workflow"`

	Default Job `json:"default"`
	// contains filtered or unexported fields
}

func Parse

func Parse(fileName string) (*Pipeline, error)

func (*Pipeline) GetActiveJobs

func (pipeline *Pipeline) GetActiveJobs(in_variables Variables) (map[string]Job, error)

func (*Pipeline) GetJobs

func (pipeline *Pipeline) GetJobs() map[string]Job

func (*Pipeline) GetJobsByStage

func (pipeline *Pipeline) GetJobsByStage(stage string) map[string]Job

func (*Pipeline) String

func (pipeline *Pipeline) String() string

type Rule

type Rule struct {
	If   string
	When string `default:"on_success"`

	Needs        Needs
	Variables    map[string]string
	AllowFailure AllowFailure `gitlabci:"allow_failure"`
	// contains filtered or unexported fields
}

func (*Rule) Parse

func (rule *Rule) Parse(template any) error

type Variables

type Variables map[string]string

func NewVariables

func NewVariables() Variables

func (Variables) Copy

func (vars Variables) Copy() Variables

func (Variables) ForJob

func (vars Variables) ForJob(job Job) Variables

Creates a copy of the current variables and with additional job variables set

func (Variables) ForPipeline

func (vars Variables) ForPipeline(pipeline Pipeline) Variables

func (Variables) Overwrite

func (vars Variables) Overwrite(overwrites Variables) Variables

func (Variables) WithBranch

func (vars Variables) WithBranch(branch string) Variables

func (Variables) WithDefaultBranch

func (vars Variables) WithDefaultBranch(defaultBranch string) Variables

func (Variables) WithMergeRequest

func (vars Variables) WithMergeRequest() Variables

type WorkFlow

type WorkFlow struct {
	Name string
}

func (*WorkFlow) Parse

func (workflow *WorkFlow) Parse(template any) error

type WorkflowRule

type WorkflowRule struct {
	Rule
	AutoCancel AutoCancel `gitlabci:"auto_cancel"`
}

func (*WorkflowRule) Parse

func (rule *WorkflowRule) Parse(template any) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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