templates

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package templates provides typed wrappers for GitLab CI/CD templates. These wrappers make it easy to include official GitLab templates in your pipeline definitions with typed configuration.

Index

Constants

View Source
const (
	// Auto DevOps template paths
	AutoDevOpsTemplate = "Auto-DevOps.gitlab-ci.yml"

	// Job template paths
	JobsBuildTemplate  = "Jobs/Build.gitlab-ci.yml"
	JobsTestTemplate   = "Jobs/Test.gitlab-ci.yml"
	JobsDeployTemplate = "Jobs/Deploy.gitlab-ci.yml"
	JobsSASTTemplate   = "Jobs/SAST.gitlab-ci.yml"
	JobsDASTTemplate   = "Jobs/DAST.gitlab-ci.yml"
)

Include types for template references.

Variables

This section is empty.

Functions

func AutoDevOps

func AutoDevOps(config *AutoDevOpsConfig) pipeline.Include

AutoDevOps returns an Include for the Auto DevOps template.

func AutoDevOpsVariables

func AutoDevOpsVariables(config *AutoDevOpsConfig) map[string]any

AutoDevOpsVariables returns pipeline variables for Auto DevOps configuration.

func Build

func Build(config *BuildConfig) pipeline.Include

Build returns an Include for the Jobs/Build template.

func BuildVariables

func BuildVariables(config *BuildConfig) map[string]any

BuildVariables returns pipeline variables for Build configuration.

func DAST

func DAST(config *DASTConfig) pipeline.Include

DAST returns an Include for the Jobs/DAST template.

func DASTVariables

func DASTVariables(config *DASTConfig) map[string]any

DASTVariables returns pipeline variables for DAST configuration.

func Deploy

func Deploy(config *DeployConfig) pipeline.Include

Deploy returns an Include for the Jobs/Deploy template.

func DeployVariables

func DeployVariables(config *DeployConfig) map[string]any

DeployVariables returns pipeline variables for Deploy configuration.

func SAST

func SAST(config *SASTConfig) pipeline.Include

SAST returns an Include for the Jobs/SAST template.

func SASTVariables

func SASTVariables(config *SASTConfig) map[string]any

SASTVariables returns pipeline variables for SAST configuration.

func Test

func Test(config *TestConfig) pipeline.Include

Test returns an Include for the Jobs/Test template.

func TestVariables

func TestVariables(config *TestConfig) map[string]any

TestVariables returns pipeline variables for Test configuration.

Types

type AutoDevOpsConfig

type AutoDevOpsConfig struct {
	// AutoDevOpsPlatformTarget specifies the deployment target (EC2, ECS, etc.)
	AutoDevOpsPlatformTarget string `yaml:"AUTO_DEVOPS_PLATFORM_TARGET,omitempty"`
	// AutoDevopsBuildImageVersion specifies the build image version
	AutoDevopsBuildImageVersion string `yaml:"AUTO_DEVOPS_BUILD_IMAGE_VERSION,omitempty"`
	// BuildDisabled disables the build job
	BuildDisabled bool `yaml:"BUILD_DISABLED,omitempty"`
	// TestDisabled disables test jobs
	TestDisabled bool `yaml:"TEST_DISABLED,omitempty"`
	// CodeQualityDisabled disables code quality scanning
	CodeQualityDisabled bool `yaml:"CODE_QUALITY_DISABLED,omitempty"`
	// SASTDisabled disables SAST scanning
	SASTDisabled bool `yaml:"SAST_DISABLED,omitempty"`
	// DependencyScanningDisabled disables dependency scanning
	DependencyScanningDisabled bool `yaml:"DEPENDENCY_SCANNING_DISABLED,omitempty"`
	// ContainerScanningDisabled disables container scanning
	ContainerScanningDisabled bool `yaml:"CONTAINER_SCANNING_DISABLED,omitempty"`
	// DASTDisabled disables DAST scanning
	DASTDisabled bool `yaml:"DAST_DISABLED,omitempty"`
	// LicenseManagementDisabled disables license management
	LicenseManagementDisabled bool `yaml:"LICENSE_MANAGEMENT_DISABLED,omitempty"`
	// PerformanceDisabled disables performance testing
	PerformanceDisabled bool `yaml:"PERFORMANCE_DISABLED,omitempty"`
	// ReviewDisabled disables review apps
	ReviewDisabled bool `yaml:"REVIEW_DISABLED,omitempty"`
	// StagingEnabled enables staging deployment
	StagingEnabled bool `yaml:"STAGING_ENABLED,omitempty"`
	// CanaryEnabled enables canary deployments
	CanaryEnabled bool `yaml:"CANARY_ENABLED,omitempty"`
	// IncrementalRolloutEnabled enables incremental rollouts
	IncrementalRolloutEnabled bool `yaml:"INCREMENTAL_ROLLOUT_ENABLED,omitempty"`
	// KubernetesVersion specifies the kubectl version
	KubernetesVersion string `yaml:"KUBERNETES_VERSION,omitempty"`
	// HelmVersion specifies the Helm version
	HelmVersion string `yaml:"HELM_VERSION,omitempty"`
}

AutoDevOpsConfig holds configuration for the Auto DevOps template.

type BuildConfig

type BuildConfig struct {
	// DockerDriver specifies the Docker driver (overlay2, etc.)
	DockerDriver string `yaml:"DOCKER_DRIVER,omitempty"`
	// DockerTLSCertDir specifies the TLS certificate directory
	DockerTLSCertDir string `yaml:"DOCKER_TLS_CERTDIR,omitempty"`
	// BuildDisabled disables the build job
	BuildDisabled bool `yaml:"BUILD_DISABLED,omitempty"`
	// CIDebugServices enables debug output for services
	CIDebugServices bool `yaml:"CI_DEBUG_SERVICES,omitempty"`
}

BuildConfig holds configuration for Jobs/Build template.

type DASTConfig

type DASTConfig struct {
	// DASTDisabled disables DAST scanning
	DASTDisabled bool `yaml:"DAST_DISABLED,omitempty"`
	// DASTWebsiteURL specifies the URL to scan
	DASTWebsiteURL string `yaml:"DAST_WEBSITE,omitempty"`
	// DASTFullScanEnabled enables full scan mode
	DASTFullScanEnabled bool `yaml:"DAST_FULL_SCAN_ENABLED,omitempty"`
	// DASTAuthURL specifies the authentication URL
	DASTAuthURL string `yaml:"DAST_AUTH_URL,omitempty"`
	// DASTUsername specifies the authentication username
	DASTUsername string `yaml:"DAST_USERNAME,omitempty"`
	// DASTPassword specifies the authentication password
	DASTPassword string `yaml:"DAST_PASSWORD,omitempty"`
}

DASTConfig holds configuration for Jobs/DAST template.

type DeployConfig

type DeployConfig struct {
	// KubeContext specifies the Kubernetes context
	KubeContext string `yaml:"KUBE_CONTEXT,omitempty"`
	// KubeIngress specifies the ingress class
	KubeIngress string `yaml:"KUBE_INGRESS_CLASS,omitempty"`
	// ReviewDisabled disables review apps
	ReviewDisabled bool `yaml:"REVIEW_DISABLED,omitempty"`
	// StagingEnabled enables staging deployment
	StagingEnabled bool `yaml:"STAGING_ENABLED,omitempty"`
	// CanaryEnabled enables canary deployments
	CanaryEnabled bool `yaml:"CANARY_ENABLED,omitempty"`
	// IncrementalRolloutEnabled enables incremental rollouts
	IncrementalRolloutEnabled bool `yaml:"INCREMENTAL_ROLLOUT_ENABLED,omitempty"`
}

DeployConfig holds configuration for Jobs/Deploy template.

type SASTConfig

type SASTConfig struct {
	// SASTDisabled disables SAST scanning
	SASTDisabled bool `yaml:"SAST_DISABLED,omitempty"`
	// SASTExcludedAnalyzers specifies analyzers to exclude
	SASTExcludedAnalyzers string `yaml:"SAST_EXCLUDED_ANALYZERS,omitempty"`
	// SASTExcludedPaths specifies paths to exclude
	SASTExcludedPaths string `yaml:"SAST_EXCLUDED_PATHS,omitempty"`
	// SecureAnalyzersPrefix specifies the analyzer image prefix
	SecureAnalyzersPrefix string `yaml:"SECURE_ANALYZERS_PREFIX,omitempty"`
}

SASTConfig holds configuration for Jobs/SAST template.

type TestConfig

type TestConfig struct {
	// TestDisabled disables the test job
	TestDisabled bool `yaml:"TEST_DISABLED,omitempty"`
	// CodeQualityDisabled disables code quality
	CodeQualityDisabled bool `yaml:"CODE_QUALITY_DISABLED,omitempty"`
}

TestConfig holds configuration for Jobs/Test template.

Jump to

Keyboard shortcuts

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