schema

package
v1.8.0-alpha-aaaabbbb1234 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gitlab was largely generated by an AI from the schema There doesn't seem to be a reliable way of generating types (go structs) from the CI schema

tried quicktype and

Index

Constants

This section is empty.

Variables

View Source
var ErrMustIncludeSubComponents = errors.New("must include at least one")

Functions

func ToYAMLNode

func ToYAMLNode(v interface{}) (*yamlv3.Node, error)

ToYAMLNode converts any Go struct/map/slice/array/primitive into a yamlv3.Node.

This is required to work with the yamlV3 library - it currently does not provide a higher level abstraction

func WriteOut

func WriteOut(w io.Writer, v any) error

Types

type GitLabArtifacts

type GitLabArtifacts struct {
	Paths    []string      `json:"paths,omitempty" yaml:"paths,omitempty"`
	Exclude  []string      `json:"exclude,omitempty" yaml:"exclude,omitempty"`
	ExpireIn string        `json:"expire_in,omitempty" yaml:"expire_in,omitempty"`
	When     string        `json:"when,omitempty" yaml:"when,omitempty"`
	Reports  GitLabReports `json:"reports,omitempty" yaml:"reports,omitempty"`
}

Artifacts represents the configuration for job artifacts.

type GitLabCI

type GitLabCI struct {
	Version      string               `json:"version,omitempty" yaml:"version,omitempty"`
	Stages       []string             `json:"stages,omitempty" yaml:"stages,omitempty"`
	Variables    map[string]string    `json:"variables,omitempty" yaml:"variables,omitempty"`
	Include      []GitLabInclude      `json:"include,omitempty" yaml:"include,omitempty"`
	Jobs         map[string]GitLabJob `json:"jobs,omitempty" yaml:"jobs,omitempty"`
	BeforeScript []string             `json:"before_script,omitempty" yaml:"before_script,omitempty"`
	AfterScript  []string             `json:"after_script,omitempty" yaml:"after_script,omitempty"`
	Image        GitLabImage          `json:"image,omitempty" yaml:"image,omitempty"`
	Services     []GitLabService      `json:"services,omitempty" yaml:"services,omitempty"`
}

GitLabCI represents the root structure of a GitLab CI pipeline file.

type GitLabImage

type GitLabImage struct {
	Name       string `json:"name,omitempty" yaml:"name,omitempty"`
	EntryPoint string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
}

Image represents the Docker image configuration.

type GitLabInclude

type GitLabInclude struct {
	Local    string `json:"local,omitempty" yaml:"local,omitempty"`
	File     string `json:"file,omitempty" yaml:"file,omitempty"`
	Template string `json:"template,omitempty" yaml:"template,omitempty"`
	Remote   string `json:"remote,omitempty" yaml:"remote,omitempty"`
	Ref      string `json:"ref,omitempty" yaml:"ref,omitempty"`
	Project  string `json:"project,omitempty" yaml:"project,omitempty"`
}

Include represents external files that can be included into the CI configuration.

type GitLabJob

type GitLabJob struct {
	Script       []string           `json:"script,omitempty" yaml:"script,omitempty"`
	Stage        string             `json:"stage,omitempty" yaml:"stage,omitempty"`
	Tags         []string           `json:"tags,omitempty" yaml:"tags,omitempty"`
	Only         GitLabJobCondition `json:"only,omitempty" yaml:"only,omitempty"`
	Except       GitLabJobCondition `json:"except,omitempty" yaml:"except,omitempty"`
	Variables    map[string]string  `json:"variables,omitempty" yaml:"variables,omitempty"`
	When         string             `json:"when,omitempty" yaml:"when,omitempty"`
	AllowFailure bool               `json:"allow_failure,omitempty" yaml:"allow_failure,omitempty"`
	BeforeScript []string           `json:"before_script,omitempty" yaml:"before_script,omitempty"`
	AfterScript  []string           `json:"after_script,omitempty" yaml:"after_script,omitempty"`
	Dependencies []string           `json:"dependencies,omitempty" yaml:"dependencies,omitempty"`
	Artifacts    GitLabArtifacts    `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
	Retry        GitLabRetry        `json:"retry,omitempty" yaml:"retry,omitempty"`
}

Job represents a single job definition in GitLab CI.

type GitLabJobCondition

type GitLabJobCondition struct {
	Refs       []string `json:"refs,omitempty" yaml:"refs,omitempty"`
	Variables  []string `json:"variables,omitempty" yaml:"variables,omitempty"`
	Kubernetes []string `json:"kubernetes,omitempty" yaml:"kubernetes,omitempty"`
}

JobCondition represents conditions for when a job runs.

type GitLabReports

type GitLabReports struct {
	JUnit     string   `json:"junit,omitempty" yaml:"junit,omitempty"`
	Artifacts []string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
}

Reports represent specific test reports that are uploaded after a job.

type GitLabRetry

type GitLabRetry struct {
	Max  int      `json:"max,omitempty" yaml:"max,omitempty"`
	When []string `json:"when,omitempty" yaml:"when,omitempty"`
}

Retry represents the retry configuration for a job.

type GitLabService

type GitLabService struct {
	Name       string `json:"name,omitempty" yaml:"name,omitempty"`
	Alias      string `json:"alias,omitempty" yaml:"alias,omitempty"`
	EntryPoint string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"`
	Command    string `json:"command,omitempty" yaml:"command,omitempty"`
}

Service represents services that are used during the job execution.

type GithubContainer

type GithubContainer struct {
	Image       string                      `json:"image" yaml:"image"`                                 // The Docker image to use for the container.
	Credentials *GithubContainerCredentials `json:"credentials,omitempty" yaml:"credentials,omitempty"` // Credentials for the container registry, if required.
	Env         map[string]string           `json:"env,omitempty" yaml:"env,omitempty"`                 // Environment variables for the container.
	Ports       []interface{}               `json:"ports,omitempty" yaml:"ports,omitempty"`             // Array of ports to expose, can be numbers or strings.
	Volumes     []string                    `json:"volumes,omitempty" yaml:"volumes,omitempty"`         // Array of volumes to use in the container.
	Options     string                      `json:"options,omitempty" yaml:"options,omitempty"`         // Additional Docker container options.
}

Container represents a container configuration for a GitHub Action job.

type GithubContainerCredentials

type GithubContainerCredentials struct {
	Username string `json:"username,omitempty" yaml:"username,omitempty"` // Username for the container registry.
	Password string `json:"password,omitempty" yaml:"password,omitempty"` // Password for the container registry.
}

ContainerCredentials represents credentials for the container registry.

type GithubDefaultRun

type GithubDefaultRun struct {
	Shell            string `json:"shell,omitempty" yaml:"shell,omitempty"`
	WorkingDirectory string `json:"working-directory,omitempty" yaml:"working_directory,omitempty"`
}

DefaultRun represents default run configurations for the jobs in the workflow.

type GithubDefaults

type GithubDefaults struct {
	Run GithubDefaultRun `json:"run,omitempty" yaml:"run,omitempty"`
}

Defaults represents default values for jobs in the GitHub workflow.

type GithubInput

type GithubInput struct {
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool   `json:"required,omitempty" yaml:"required,omitempty"`
	Default     string `json:"default,omitempty" yaml:"default,omitempty"`
}

Input represents an input for a workflow dispatch event.

type GithubJob

type GithubJob struct {
	Name           string            `json:"name,omitempty" yaml:"name,omitempty"`
	Needs          []string          `json:"needs,omitempty" yaml:"needs,omitempty"`
	RunsOn         string            `json:"runs-on,omitempty" yaml:"runs-on,omitempty"`
	Container      *GithubContainer  `json:"container,omitempty" yaml:"container,omitempty"`
	Steps          []*GithubStep     `json:"steps,omitempty" yaml:"steps,omitempty"`
	If             string            `json:"if,omitempty" yaml:"if,omitempty"`
	Env            map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Environment    string            `json:"environment,omitempty" yaml:"environment,omitempty"`
	TimeoutMinutes int               `json:"timeout-minutes,omitempty" yaml:"timeout_minutes,omitempty"`
	Strategy       *GithubStrategy   `json:"strategy,omitempty" yaml:"strategy,omitempty"`
}

Job represents a job in the GitHub workflow.

func (*GithubJob) AddStep

func (job *GithubJob) AddStep(step *GithubStep) error

type GithubPullRequestEvent

type GithubPullRequestEvent struct {
	Branches       []string `json:"branches,omitempty" yaml:"branches,omitempty"`
	Paths          []string `json:"paths,omitempty" yaml:"paths,omitempty"`
	BranchesIgnore []string `json:"branches-ignore,omitempty" yaml:"branches_ignore,omitempty"`
	PathsIgnore    []string `json:"paths-ignore,omitempty" yaml:"paths_ignore,omitempty"`
	Types          []string `json:"types,omitempty" yaml:"types,omitempty"`
}

PullRequestEvent represents a pull request event trigger configuration.

type GithubPushEvent

type GithubPushEvent struct {
	Branches       []string `json:"branches,omitempty" yaml:"branches,omitempty"`
	Tags           []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	Paths          []string `json:"paths,omitempty" yaml:"paths,omitempty"`
	PathsIgnore    []string `json:"paths-ignore,omitempty" yaml:"paths_ignore,omitempty"`
	BranchesIgnore []string `json:"branches-ignore,omitempty" yaml:"branches_ignore,omitempty"`
	TagsIgnore     []string `json:"tags-ignore,omitempty" yaml:"tags_ignore,omitempty"`
}

PushEvent represents a push event trigger configuration.

type GithubScheduleEvent

type GithubScheduleEvent struct {
	Cron string `json:"cron,omitempty" yaml:"cron,omitempty"`
}

ScheduleEvent represents a cron schedule event trigger configuration.

type GithubStep

type GithubStep struct {
	Name            string            `json:"name,omitempty" yaml:"name,omitempty"`
	ID              string            `json:"id,omitempty" yaml:"id,omitempty"`
	Uses            string            `json:"uses,omitempty" yaml:"uses,omitempty"`
	Run             string            `json:"run,omitempty" yaml:"run,omitempty"`
	With            map[string]string `json:"with,omitempty" yaml:"with,omitempty"`
	Env             map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Shell           string            `json:"shell,omitempty" yaml:"shell,omitempty"`
	ContinueOnError bool              `json:"continue-on-error,omitempty" yaml:"continue_on_error,omitempty"`
	TimeoutMinutes  int               `json:"timeout-minutes,omitempty" yaml:"timeout_minutes,omitempty"`
	If              string            `json:"if,omitempty" yaml:"if,omitempty"`
}

Step represents a step in a GitHub job.

type GithubStrategy

type GithubStrategy struct {
	Matrix      map[string][]string `json:"matrix,omitempty" yaml:"matrix,omitempty"`
	MaxParallel int                 `json:"max-parallel,omitempty" yaml:"max_parallel,omitempty"`
	FailFast    bool                `json:"fail-fast,omitempty" yaml:"fail_fast,omitempty"`
}

Strategy represents a job strategy (matrix) configuration.

type GithubTriggerEvents

type GithubTriggerEvents struct {
	Push             GithubPushEvent             `json:"push,omitempty" yaml:"push,omitempty"`
	PullRequest      GithubPullRequestEvent      `json:"pull_request,omitempty" yaml:"pull_request,omitempty"`
	Schedule         []GithubScheduleEvent       `json:"schedule,omitempty" yaml:"schedule,omitempty"`
	WorkflowDispatch GithubWorkflowDispatchEvent `json:"workflow_dispatch,omitempty" yaml:"workflow_dispatch,omitempty"`
}

TriggerEvents represents the trigger events for the GitHub workflow.

type GithubWorkflow

type GithubWorkflow struct {
	Name string               `json:"name,omitempty" yaml:"name,omitempty"`
	On   *GithubTriggerEvents `json:"on" yaml:"on"`
	Jobs yaml.MapSlice        `json:"jobs" yaml:"jobs"`
	// Jobs        yaml.Node         `json:"jobs" yaml:"jobs"`
	Defaults    *GithubDefaults   `json:"defaults,omitempty" yaml:"defaults,omitempty"`
	Env         map[string]any    `json:"env,omitempty" yaml:"env,omitempty"`
	Permissions map[string]string `json:"permissions,omitempty" yaml:"permissions,omitempty"`
}

Workflow represents the root of a GitHub workflow file.

type GithubWorkflowDispatchEvent

type GithubWorkflowDispatchEvent struct {
	Inputs map[string]GithubInput `json:"inputs,omitempty" yaml:"inputs,omitempty"`
}

WorkflowDispatchEvent represents a manually triggered workflow dispatch event.

Jump to

Keyboard shortcuts

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