ci

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: 0BSD Imports: 14 Imported by: 0

Documentation

Overview

Package ci parses .gitbay/ci.yml, the per-repo build configuration:

jobs:
  test:
    steps:
      - go test ./...

Each job becomes one build per push; each step is a shell command the runner executes with `sh -c`, stopping at the first failure.

Index

Constants

View Source
const ConfigPath = ".gitbay/ci.yml"

ConfigPath is where the build configuration lives in a repository.

Variables

This section is empty.

Functions

func NextRun

func NextRun(expr string, after time.Time) string

NextRun returns the next firing time for a cron expression as a stored timestamp. The caller has already validated the expression.

Types

type Cron

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

Cron is a parsed five-field expression: minute, hour, day-of-month, month, day-of-week. Supported per field: "*", N, A-B, */N, A-B/N, and comma lists. Day-of-month and day-of-week combine with OR when both are restricted, per traditional cron.

func ParseCron

func ParseCron(expr string) (Cron, error)

ParseCron validates and compiles an expression like "17 11,23 * * *".

func (Cron) Matches

func (c Cron) Matches(t time.Time) bool

Matches reports whether the expression fires at t (minute precision).

func (Cron) Next

func (c Cron) Next(t time.Time) time.Time

Next returns the first firing time strictly after t, or the zero time if none exists within a year (an impossible date like Feb 30).

type Job

type Job struct {
	Name     string
	Steps    []string
	Schedule string // cron expression; scheduled jobs run on schedule, not on push
	Tags     string // tag glob (e.g. "v*"); tag jobs run on matching tag pushes only
}

func Parse

func Parse(raw []byte) ([]Job, error)

Parse returns the jobs in name order, or an error describing the first problem so the pusher can fix the file.

type Scheduler

type Scheduler struct {
	St      *store.Store
	RepoDir func(owner, name string) string
	SiteURL string
}

Scheduler fires scheduled builds. repoDir maps a repo to its bare path.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

Run ticks until the context ends. GITBAY_SCHED_TICK overrides the interval for tests.

func (*Scheduler) RunDue

func (s *Scheduler) RunDue(now time.Time)

RunDue queues every due scheduled build and advances its next_run. Split from the ticker for tests.

Source Files

  • ci.go
  • cron.go
  • sched.go

Jump to

Keyboard shortcuts

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