config

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactReports

type ArtifactReports struct {
	Terraform []string `yaml:"terraform,omitempty" json:"terraform,omitempty" jsonschema:"description=Terraform report paths"`
	JUnit     []string `yaml:"junit,omitempty" json:"junit,omitempty" jsonschema:"description=JUnit report paths"`
	Cobertura []string `yaml:"cobertura,omitempty" json:"cobertura,omitempty" jsonschema:"description=Cobertura coverage report paths"`
}

ArtifactReports defines artifact reports configuration.

type ArtifactsConfig

type ArtifactsConfig struct {
	Paths     []string         `yaml:"paths,omitempty" json:"paths,omitempty" jsonschema:"description=File/directory paths to include as artifacts"`
	ExpireIn  string           `` /* 132-byte string literal not displayed */
	Reports   *ArtifactReports `yaml:"reports,omitempty" json:"reports,omitempty" jsonschema:"description=Artifact reports configuration"`
	Name      string           `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"description=Artifact archive name"`
	Untracked bool             `yaml:"untracked,omitempty" json:"untracked,omitempty" jsonschema:"description=Include all untracked files"`
	When      string           `` /* 137-byte string literal not displayed */
	ExposeAs  string           `yaml:"expose_as,omitempty" json:"expose_as,omitempty" jsonschema:"description=Makes artifacts available in MR UI"`
}

ArtifactsConfig defines GitLab CI artifacts configuration.

type CacheConfig added in v0.9.5

type CacheConfig struct {
	Enabled *bool    `yaml:"enabled,omitempty" json:"enabled,omitempty" jsonschema:"description=Enable GitLab cache for terraform jobs"`
	Key     string   `` /* 177-byte string literal not displayed */
	Paths   []string `` /* 183-byte string literal not displayed */
	Policy  string   `` /* 127-byte string literal not displayed */
}

CacheConfig defines advanced GitLab CI cache configuration.

type CfgSecret

type CfgSecret struct {
	Vault *CfgVaultSecret `yaml:"vault,omitempty" json:"vault,omitempty" jsonschema:"description=HashiCorp Vault secret configuration"`
	File  bool            `yaml:"file,omitempty" json:"file,omitempty" jsonschema:"description=Write secret to a file"`
}

CfgSecret defines a CI/CD secret in the config file.

type CfgVaultSecret

type CfgVaultSecret struct {
	Engine    *VaultEngine `yaml:"engine,omitempty" json:"engine,omitempty" jsonschema:"description=Vault secrets engine configuration"`
	Path      string       `yaml:"path,omitempty" json:"path,omitempty" jsonschema:"description=Path to the secret in Vault"`
	Field     string       `yaml:"field,omitempty" json:"field,omitempty" jsonschema:"description=Field to extract from the secret"`
	Shorthand string       `yaml:"-" jsonschema:"-"`
}

CfgVaultSecret defines a secret from HashiCorp Vault in the config file.

func (*CfgVaultSecret) UnmarshalYAML

func (v *CfgVaultSecret) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML supports both shorthand and full object syntax.

type Config

type Config struct {
	Image        Image             `yaml:"image" json:"image" jsonschema:"description=Docker image for terraform jobs,default=hashicorp/terraform:1.6"`
	StagesPrefix string            `` /* 153-byte string literal not displayed */
	Variables    map[string]string `yaml:"variables,omitempty" json:"variables,omitempty" jsonschema:"description=Global pipeline variables"`
	PlanOnly     bool              `yaml:"plan_only" json:"plan_only" jsonschema:"description=Generate only plan jobs (no apply jobs),default=false"`
	CacheEnabled bool              `yaml:"cache_enabled" json:"cache_enabled" jsonschema:"description=Enable caching of .terraform directory,default=true"`
	Cache        *CacheConfig      `yaml:"cache,omitempty" json:"cache,omitempty" jsonschema:"description=Advanced GitLab cache configuration for terraform jobs"`
	Rules        []Rule            `yaml:"rules,omitempty" json:"rules,omitempty" jsonschema:"description=Workflow rules for conditional pipeline execution"`
	JobDefaults  *JobDefaults      `yaml:"job_defaults,omitempty" json:"job_defaults,omitempty" jsonschema:"description=Default settings applied to all jobs"`
	Overwrites   []JobOverwrite    `yaml:"overwrites,omitempty" json:"overwrites,omitempty" jsonschema:"description=Job-level overrides for plan or apply jobs"`
}

Config contains GitLab CI specific settings.

func (*Config) Clone added in v0.10.5

func (g *Config) Clone() *Config

Clone returns a deep copy of the GitLab CI configuration.

func (*Config) GetImage

func (g *Config) GetImage() Image

GetImage returns the configured image.

func (*Config) Validate added in v0.10.0

func (c *Config) Validate() error

Validate runs the GitLab plugin's config-shape sanity checks. Called from the plugin's Preflight after DecodeAndSet — fails fast with a descriptive error rather than emitting YAML-shaped garbage in the generated pipeline.

Catches misconfigured enums (cache.policy, JobOverwrite.Type) and obvious missing fields. Avoids semantic checks that need network or filesystem.

type IDToken

type IDToken struct {
	Aud string `yaml:"aud" json:"aud"`
}

IDToken represents configured OIDC token settings.

type Image

type Image = ci.Image

Type aliases for shared types keep the public config surface stable.

type JobConfig

type JobConfig interface {
	GetImage() *Image
	GetIDTokens() map[string]IDToken
	GetSecrets() map[string]CfgSecret
	GetBeforeScript() []string
	GetAfterScript() []string
	GetArtifacts() *ArtifactsConfig
	GetTags() []string
	GetRules() []Rule
	GetWhen() string
	GetVariables() map[string]string
}

JobConfig is a shared read-only view over job defaults and overwrites.

type JobDefaults

type JobDefaults struct {
	Image        *Image               `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"description=Docker image override for all jobs"`
	IDTokens     map[string]IDToken   `yaml:"id_tokens,omitempty" json:"id_tokens,omitempty" jsonschema:"description=OIDC tokens for cloud provider authentication"`
	Secrets      map[string]CfgSecret `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets from external secret managers"`
	BeforeScript []string             `yaml:"before_script,omitempty" json:"before_script,omitempty" jsonschema:"description=Commands to run before each job"`
	AfterScript  []string             `yaml:"after_script,omitempty" json:"after_script,omitempty" jsonschema:"description=Commands to run after each job"`
	Artifacts    *ArtifactsConfig     `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"description=GitLab CI artifacts configuration"`
	Tags         []string             `yaml:"tags,omitempty" json:"tags,omitempty" jsonschema:"description=GitLab runner tags"`
	Rules        []Rule               `yaml:"rules,omitempty" json:"rules,omitempty" jsonschema:"description=Job-level rules"`
	When         string               `` /* 147-byte string literal not displayed */
	Variables    map[string]string    `yaml:"variables,omitempty" json:"variables,omitempty" jsonschema:"description=Additional variables"`
}

JobDefaults defines default settings for all generated jobs.

func (*JobDefaults) GetAfterScript

func (j *JobDefaults) GetAfterScript() []string

func (*JobDefaults) GetArtifacts

func (j *JobDefaults) GetArtifacts() *ArtifactsConfig

func (*JobDefaults) GetBeforeScript

func (j *JobDefaults) GetBeforeScript() []string

func (*JobDefaults) GetIDTokens

func (j *JobDefaults) GetIDTokens() map[string]IDToken

func (*JobDefaults) GetImage

func (j *JobDefaults) GetImage() *Image

func (*JobDefaults) GetRules

func (j *JobDefaults) GetRules() []Rule

func (*JobDefaults) GetSecrets

func (j *JobDefaults) GetSecrets() map[string]CfgSecret

func (*JobDefaults) GetTags

func (j *JobDefaults) GetTags() []string

func (*JobDefaults) GetVariables

func (j *JobDefaults) GetVariables() map[string]string

func (*JobDefaults) GetWhen added in v0.10.3

func (j *JobDefaults) GetWhen() string

type JobOverwrite

type JobOverwrite struct {
	Type         JobOverwriteType     `yaml:"type" json:"type" jsonschema:"description=Type of jobs to override (plan\\, apply\\, or contributed job name),required"`
	Image        *Image               `yaml:"image,omitempty" json:"image,omitempty" jsonschema:"description=Docker image override for matching jobs"`
	IDTokens     map[string]IDToken   `yaml:"id_tokens,omitempty" json:"id_tokens,omitempty" jsonschema:"description=OIDC tokens for matching jobs"`
	Secrets      map[string]CfgSecret `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Secrets for matching jobs"`
	BeforeScript []string             `yaml:"before_script,omitempty" json:"before_script,omitempty" jsonschema:"description=Commands to run before matching jobs"`
	AfterScript  []string             `yaml:"after_script,omitempty" json:"after_script,omitempty" jsonschema:"description=Commands to run after matching jobs"`
	Artifacts    *ArtifactsConfig     `yaml:"artifacts,omitempty" json:"artifacts,omitempty" jsonschema:"description=Artifacts configuration for matching jobs"`
	Tags         []string             `yaml:"tags,omitempty" json:"tags,omitempty" jsonschema:"description=Runner tags for matching jobs"`
	Rules        []Rule               `yaml:"rules,omitempty" json:"rules,omitempty" jsonschema:"description=Job-level rules for matching jobs"`
	When         string               `` /* 147-byte string literal not displayed */
	Variables    map[string]string    `yaml:"variables,omitempty" json:"variables,omitempty" jsonschema:"description=Variables for matching jobs"`
}

JobOverwrite defines job-level overrides for plan or apply jobs.

func (*JobOverwrite) GetAfterScript

func (j *JobOverwrite) GetAfterScript() []string

func (*JobOverwrite) GetArtifacts

func (j *JobOverwrite) GetArtifacts() *ArtifactsConfig

func (*JobOverwrite) GetBeforeScript

func (j *JobOverwrite) GetBeforeScript() []string

func (*JobOverwrite) GetIDTokens

func (j *JobOverwrite) GetIDTokens() map[string]IDToken

func (*JobOverwrite) GetImage

func (j *JobOverwrite) GetImage() *Image

func (*JobOverwrite) GetRules

func (j *JobOverwrite) GetRules() []Rule

func (*JobOverwrite) GetSecrets

func (j *JobOverwrite) GetSecrets() map[string]CfgSecret

func (*JobOverwrite) GetTags

func (j *JobOverwrite) GetTags() []string

func (*JobOverwrite) GetVariables

func (j *JobOverwrite) GetVariables() map[string]string

func (*JobOverwrite) GetWhen added in v0.10.3

func (j *JobOverwrite) GetWhen() string

type JobOverwriteType

type JobOverwriteType string

JobOverwriteType defines the type of jobs to override.

const (
	OverwriteTypePlan  JobOverwriteType = "plan"
	OverwriteTypeApply JobOverwriteType = "apply"
)

type Rule

type Rule struct {
	If      string   `yaml:"if,omitempty" json:"if,omitempty"`
	When    string   `yaml:"when,omitempty" json:"when,omitempty"`
	Changes []string `yaml:"changes,omitempty" json:"changes,omitempty"`
}

Rule represents workflow or job rules from config input.

type VaultEngine

type VaultEngine struct {
	Name string `yaml:"name" json:"name"`
	Path string `yaml:"path" json:"path"`
}

VaultEngine represents configured Vault engine settings.

Jump to

Keyboard shortcuts

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