jobconfig

package
v0.0.0-...-8d994d8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CanBeRehearsedLabel    = "pj-rehearse.openshift.io/can-be-rehearsed"
	CanBeRehearsedValue    = "true"
	SSHBastionLabel        = "dptp.openshift.io/ssh-bastion"
	ProwJobLabelVariant    = "ci-operator.openshift.io/variant"
	ReleaseControllerLabel = "ci-operator.openshift.io/release-controller"
	LabelBuildFarm         = "ci.openshift.io/build-farm"
	LabelGenerator         = "ci.openshift.io/generator"
	ReleaseControllerValue = "true"
	JobReleaseKey          = "job-release"
	PresubmitPrefix        = "pull"
	PostsubmitPrefix       = "branch"
	PeriodicPrefix         = "periodic"
)

Variables

View Source
var SimpleBranchRegexp = regexp.MustCompile(`^[\w\-.]+$`)

SimpleBranchRegexp matches a branch name that does not appear to be a regex (lacks wildcard, group, or other modifiers). For instance, `master` is considered simple, `master-.*` would not.

Functions

func Append

func Append(dest, part *prowconfig.JobConfig)

Append merges job configuration from part into dest Jobs are assumed to not overlap.

func ExactlyBranch

func ExactlyBranch(branch string) string

ExactlyBranch returns a regex string that matches exactly the given branch name: I.e. returns '^master$' for 'master'. If the given branch name already looks like a regex, return it unchanged.

func FeatureBranch

func FeatureBranch(branch string) string

FeatureBranch returns a regex string that matches feature branch prefixes for the given branch name: I.e. returns '^master-' for 'master'. If the given branch name already looks like a regex, return it unchanged.

func IsGenerated

func IsGenerated(job prowconfig.JobBase, generator Generator) (bool, error)

IsGenerated returns true if the job was generated by the provided Generator

func MakeRegexFilenameLabel

func MakeRegexFilenameLabel(possibleRegex string) string

func OperateOnJobConfigDir

func OperateOnJobConfigDir(configDir string, knownInfraJobFiles sets.Set[string], callback func(*prowconfig.JobConfig, *Info) error) error

func OperateOnJobConfigSubdir

func OperateOnJobConfigSubdir(configDir, subDir string, knownInfraJobFiles sets.Set[string], callback func(*prowconfig.JobConfig, *Info) error) error

func OperateOnJobConfigSubdirPaths

func OperateOnJobConfigSubdirPaths(configDir, subDir string, knownInfraJobFiles sets.Set[string], callback func(*Info) error) error

func Prune

func Prune(jobConfig *prowconfig.JobConfig, generator Generator, pruneLabels labels.Set) (*prowconfig.JobConfig, error)

Prune removes all generated jobs of the supplied Generator with values that are NOT newly-generated. Prune() returns the resulting job config (which may even be completely empty).

func ReadFromDir

func ReadFromDir(dir string) (*prowconfig.JobConfig, error)

ReadFromDir reads Prow job config from a directory and merges into one config

func WriteToDir

func WriteToDir(jobDir, org, repo string, jobConfig *prowconfig.JobConfig, generator Generator, matchLabels labels.Set) error

WriteToDir takes a JobConfig and a target directory, and writes the Prow job configuration into files in that directory. Jobs are sharded by branch and by type. If target files already exist and contain Prow job configuration, the jobs will be merged. Jobs will be pruned based on the provided Generator that match the matchLabels set

func WriteToFile

func WriteToFile(path string, jobConfig *prowconfig.JobConfig) error

WriteToFile writes Prow job config to a YAML file

Types

type Generator

type Generator string

type Info

type Info struct {
	Org    string
	Repo   string
	Branch string
	// Type is the type of ProwJob contained in this file
	Type string
	// Filename is the full path to the file on disk
	Filename string
}

Info describes the metadata for a Prow job configuration file

func (*Info) Basename

func (i *Info) Basename() string

Basename returns the unique name for this file in the config

func (*Info) ConfigMapName

func (i *Info) ConfigMapName() string

ConfigMapName returns the configmap in which we expect this file to be uploaded

Jump to

Keyboard shortcuts

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