Help us shape the future of Go! Take the 2026 Go Developer Survey

ciutils

package
v1.124.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTracePollInterval = 3 * time.Second

Variables

This section is empty.

Functions

func DisplayMultiplePipelines

func DisplayMultiplePipelines(s *iostreams.IOStreams, p []*gitlab.PipelineInfo, projectID string) string

func DisplaySchedules

func DisplaySchedules(i *iostreams.IOStreams, s []*gitlab.PipelineSchedule, projectID string) string

func GetBranch added in v1.68.0

func GetBranch(branch string, currentBranch func() (string, error), repo glrepo.Interface, client *gitlab.Client) string

GetBranch returns the specified branch, current git branch, or the default branch from API

func GetDefaultBranch

func GetDefaultBranch(repo glrepo.Interface, client *gitlab.Client) string

GetDefaultBranch fetches the repository's default branch from GitLab API. Falls back to git.DefaultBranchName if the API call fails or returns empty.

func GetJobId

func GetJobId(ctx context.Context, inputs *JobInputs, opts *JobOptions) (int64, error)

func GetPipelineWithFallback added in v1.79.0

func GetPipelineWithFallback(ctx context.Context, client *gitlab.Client, repoName, branch string, ios *iostreams.IOStreams) (*gitlab.Pipeline, error)

GetPipelineWithFallback gets the latest pipeline for a branch, falling back to MR head pipeline for merged results pipelines where the direct branch lookup may fail or returns a pipeline with no jobs.

func IDsFromArgs

func IDsFromArgs(args []string) ([]int, error)

IDsFromArgs parses list of IDs from space or comma-separated values

func RunTraceJob added in v1.115.0

func RunTraceJob(ctx context.Context, apiClient *gitlab.Client, w io.Writer, pid any, jobID int64, pollInterval time.Duration) error

RunTraceJob streams jobID's trace to w. A zero pollInterval uses DefaultTracePollInterval.

func TraceJob

func TraceJob(ctx context.Context, inputs *JobInputs, opts *JobOptions) error

Types

type JobInputs

type JobInputs struct {
	JobName            string
	Branch             string
	PipelineId         int
	SelectionPrompt    string
	SelectionPredicate func(s *gitlab.Job) bool
}

type JobOptions

type JobOptions struct {
	Client       *gitlab.Client
	Repo         glrepo.Interface
	IO           *iostreams.IOStreams
	BranchFunc   func() (string, error)
	PollInterval time.Duration // interval between trace polls; defaults to 3s if zero
}

Jump to

Keyboard shortcuts

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