gitlab

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchGitLabDefaultBranch added in v1.0.1

func FetchGitLabDefaultBranch(instanceURL, owner, repo string) string

FetchGitLabDefaultBranch is the public wrapper for fetching GitLab default branch

func FindGitLabWorkflows

func FindGitLabWorkflows(repoPath string) ([]parser.WorkflowFile, error)

FindGitLabWorkflows searches for GitLab CI/CD files in a repository

func GenerateFileURL added in v0.0.4

func GenerateFileURL(repoURL, filePath string, lineNumber int) string

GenerateFileURL generates a GitLab URL pointing to a specific file and line number

func GenerateFileURLWithBranch added in v0.0.7

func GenerateFileURLWithBranch(repoURL, filePath string, lineNumber int, branch string) string

GenerateFileURLWithBranch creates a GitLab URL using an explicit branch name (no SHA).

func GitLabRules

func GitLabRules() []rules.Rule

GitLabRules returns GitLab CI/CD specific security rules

func IsGitLabURL

func IsGitLabURL(repoURL string) bool

IsGitLabURL checks if a URL is a GitLab repository URL

func LoadSingleGitLabWorkflow

func LoadSingleGitLabWorkflow(filePath string) ([]parser.WorkflowFile, error)

LoadSingleGitLabWorkflow loads and parses a single GitLab CI file

func ParseRepositoryURL

func ParseRepositoryURL(repoURL string) (instanceURL, owner, repo string, err error)

ParseRepositoryURL parses a GitLab repository URL and detects the instance

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a GitLab repository client

func NewClient

func NewClient(instanceURL string) (*Client, error)

NewClient creates a new GitLab client instanceURL can be: - "" or "https://gitlab.com" for GitLab SaaS - "https://gitlab.company.com" for on-premise instances

func (*Client) CloneRepository

func (c *Client) CloneRepository(repoURL, tempDir string) (string, error)

CloneRepository clones a GitLab repository to a temporary directory

func (*Client) CloneRepositoryWithBranch added in v1.0.1

func (c *Client) CloneRepositoryWithBranch(repoURL, tempDir, branch string) (string, error)

CloneRepositoryWithBranch clones a specific branch of a GitLab repository

func (*Client) ValidateConnection

func (c *Client) ValidateConnection() error

ValidateConnection tests basic connectivity to the GitLab instance

type GitLabJob

type GitLabJob struct {
	Stage        string                   `yaml:"stage"`
	Image        interface{}              `yaml:"image"`
	Script       []string                 `yaml:"script"`
	BeforeScript []string                 `yaml:"before_script"`
	AfterScript  []string                 `yaml:"after_script"`
	Variables    map[string]interface{}   `yaml:"variables"`
	Rules        []map[string]interface{} `yaml:"rules"`
	Only         interface{}              `yaml:"only"`
	Except       interface{}              `yaml:"except"`
	When         string                   `yaml:"when"`
	Allow        map[string]interface{}   `yaml:"allow_failure"`
	Artifacts    map[string]interface{}   `yaml:"artifacts"`
	Cache        map[string]interface{}   `yaml:"cache"`
	Services     []interface{}            `yaml:"services"`
	Needs        []interface{}            `yaml:"needs"`
	Tags         []string                 `yaml:"tags"`
	Environment  map[string]interface{}   `yaml:"environment"`
}

GitLabJob represents a job in GitLab CI/CD

type GitLabWorkflow

type GitLabWorkflow struct {
	Stages    []string                 `yaml:"stages"`
	Image     interface{}              `yaml:"image"`
	Variables map[string]interface{}   `yaml:"variables"`
	Before    []string                 `yaml:"before_script"`
	After     []string                 `yaml:"after_script"`
	Jobs      map[string]GitLabJob     `yaml:",inline"`
	Include   []map[string]interface{} `yaml:"include"`
	Workflow  map[string]interface{}   `yaml:"workflow"`
}

GitLabWorkflow represents a GitLab CI/CD pipeline

Jump to

Keyboard shortcuts

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