rehearse

package
v0.0.0-...-c780de0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Label is the label key for the pull request we are rehearsing for
	Label = "ci.openshift.io/rehearse"
	// LabelContext exposes the context the job would have had running normally
	LabelContext = "ci.openshift.io/rehearse.context"
)
View Source
const (
	RehearsalsAckLabel             = "rehearsals-ack"
	NetworkAccessRehearsalsOkLabel = "network-access-rehearsals-ok"
)

Variables

This section is empty.

Functions

func BranchFromRegexes

func BranchFromRegexes(branches []string) string

BranchFromRegexes undoes the changes we add to a branch name to make it an explicit regular expression. We can simply remove the "^$" pre/suffix and we know that `\` is an invalid character in Git branch names, so any that exist in the name have been placed there by regexp.QuoteMeta() and can simply be removed as well. Iterates over all branches and returns an empty string when no branch is a simple branch name after the stripping

func FilterJobsByRequested

func FilterJobsByRequested(requested []string, presubmits config.Presubmits, periodics config.Periodics, logger *logrus.Entry) (config.Presubmits, config.Periodics, []string)

FilterJobsByRequested returns only those presubmits and periodics that appear in the requested slice. It also returns a slice of all jobs not found in the original sets.

func NewCMClient

func NewCMClient(clusterConfig *rest.Config, namespace string, dry bool) (coreclientset.ConfigMapInterface, error)

NewCMClient creates a configMap client with a dry run capability

func NewProwJobClient

func NewProwJobClient(clusterConfig *rest.Config, dry bool) (ctrlruntimeclient.Client, error)

NewProwJobClient creates a ProwJob client with a dry run capability

func SelectJobsForChangedRegistry

func SelectJobsForChangedRegistry(regSteps []registry.Node, allPresubmits presubmitsByRepo, allPeriodics []prowconfig.Periodic, ciopConfigs config.DataByFilename, logger *logrus.Entry) (config.Presubmits, config.Periodics)

func UsesConfigMap

func UsesConfigMap(job prowconfig.JobBase, cm string) bool

func VariantFromLabels

func VariantFromLabels(labels map[string]string) string

Types

type CMManager

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

CMManager manages temporary ConfigMaps created on build clusters to be consumed by rehearsals. This is necessary when a content of a ConfigMap, such as a template or cluster profile, is changed in a pull request. In such case the rehearsals that use that ConfigMap must have access to the updated content.

func NewCMManager

func NewCMManager(
	cluster, namespace string,
	cmclient corev1.ConfigMapInterface,
	configUpdaterCfg prowplugins.ConfigUpdater,
	prNumber int,
	releaseRepoPath string,
	logger *logrus.Entry,
) *CMManager

NewCMManager creates a new CMManager

func (*CMManager) Clean

func (c *CMManager) Clean() error

Clean deletes all the configMaps that have been created for this PR

func (*CMManager) Create

func (c *CMManager) Create(cms ConfigMaps) error

type ConfigMaps

type ConfigMaps struct {
	// Paths is a set of repo paths that changed content and belong to some ConfigMap
	Paths sets.Set[string]
	// Names is a mapping from production ConfigMap names to rehearse-specific ones
	Names map[string]string
	// ProductionNames is a set of production ConfigMap names
	ProductionNames sets.Set[string]
	// Patterns is the set of config-updater patterns that cover at least one changed file
	Patterns sets.Set[string]
}

ConfigMaps holds the data about the ConfigMaps affected by a rehearse run

func NewConfigMaps

func NewConfigMaps(paths []string, purpose, SHA string, prNumber int, configUpdaterCfg prowplugins.ConfigUpdater) (ConfigMaps, error)

NewConfigMaps populates a ConfigMaps instance

type Executor

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

Executor holds all the information needed for the jobs to be executed.

func NewExecutor

func NewExecutor(presubmits []*prowconfig.Presubmit, prRepo string, refs *pjapi.Refs,
	dryRun bool, logger *logrus.Entry, pjclient ctrlruntimeclient.Client, namespace string,
	prowCfg *prowconfig.Config, waitForCompletion bool) *Executor

NewExecutor creates an executor. It also configures the rehearsal jobs as a list of presubmits.

func (*Executor) ExecuteJobs

func (e *Executor) ExecuteJobs() (bool, error)

ExecuteJobs takes configs for a set of jobs which should be "rehearsed", and creates the ProwJobs that perform the actual rehearsal. *Rehearsal* means a "trial" execution of a Prow job configuration when the *job config* config is changed, giving feedback to Prow config authors on how the changes of the config would affect the "production" Prow jobs run on the actual target repos

type JobConfigurer

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

JobConfigurer holds all the information that is needed for the configuration of the jobs.

func NewJobConfigurer

func NewJobConfigurer(
	dryRun bool,
	ciopConfigs config.DataByFilename,
	prowConfig *prowconfig.Config,
	resolver registry.Resolver,
	logger *logrus.Entry,
	refs *pjapi.Refs,
	uploader configSpecUploader) *JobConfigurer

NewJobConfigurer filters the jobs and returns a new JobConfigurer.

func (*JobConfigurer) ConfigurePeriodicRehearsals

func (jc *JobConfigurer) ConfigurePeriodicRehearsals(periodics config.Periodics) (apihelper.ImageStreamTagMap, []prowconfig.Periodic, error)

ConfigurePeriodicRehearsals adds the required configuration for the periodics to be rehearsed.

func (*JobConfigurer) ConfigurePresubmitRehearsals

func (jc *JobConfigurer) ConfigurePresubmitRehearsals(presubmits config.Presubmits) (apihelper.ImageStreamTagMap, []*prowconfig.Presubmit, error)

ConfigurePresubmitRehearsals adds the required configuration for the presubmits to be rehearsed.

func (*JobConfigurer) ConvertPeriodicsToPresubmits

func (jc *JobConfigurer) ConvertPeriodicsToPresubmits(periodics []prowconfig.Periodic) ([]*prowconfig.Presubmit, error)

ConvertPeriodicsToPresubmits converts periodic jobs to presubmits by using the same JobBase and filling up the rest of the presubmit's required fields.

type RehearsalCandidate

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

func RehearsalCandidateFromPullRequest

func RehearsalCandidateFromPullRequest(pullRequest *github.PullRequest, baseSHA string) RehearsalCandidate

type RehearsalConfig

type RehearsalConfig struct {
	ProwjobKubeconfig string
	KubernetesOptions flagutil.KubernetesOptions

	ProwjobNamespace string
	PodNamespace     string

	NoRegistry bool

	NormalLimit int
	MoreLimit   int
	MaxLimit    int

	StickyLabelAuthors sets.Set[string]

	GCSBucket          string
	GCSCredentialsFile string
	GCSBrowserPrefix   string

	DryRun bool
}

func (RehearsalConfig) AbortAllRehearsalJobs

func (r RehearsalConfig) AbortAllRehearsalJobs(org, repo string, number int, logger *logrus.Entry)

func (RehearsalConfig) DetermineAffectedJobs

func (r RehearsalConfig) DetermineAffectedJobs(candidate RehearsalCandidate, candidatePath string, networkAccessRehearsalsAllowed bool, logger *logrus.Entry) (config.Presubmits, config.Periodics, []string, error)

func (RehearsalConfig) RehearseJobs

func (r RehearsalConfig) RehearseJobs(
	candidate RehearsalCandidate,
	candidatePath string,
	prRefs *prowapi.Refs,
	presubmitsToRehearse []*prowconfig.Presubmit,
	prowCfg *prowconfig.Config,
	waitForSuccess bool,
	logger *logrus.Entry,
) (bool, error)

RehearseJobs returns true if the jobs were triggered and succeed

func (RehearsalConfig) SetupJobs

func (r RehearsalConfig) SetupJobs(candidate RehearsalCandidate, candidatePath string, presubmits config.Presubmits, periodics config.Periodics, limit int, logger *logrus.Entry) (*config.ReleaseRepoConfig, *prowapi.Refs, []*prowconfig.Presubmit, error)

Jump to

Keyboard shortcuts

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