config

package
v0.0.0-...-fc83434 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ConfigInRepoPath is the prow config path from release repo
	ConfigInRepoPath = "core-services/prow/02_config/_config.yaml"
	// ProwConfigFile is the filename where Prow config lives
	ProwConfigFile = "_config.yaml"
	// SupplementalProwConfigFileName is the name of supplemental prow config files.
	SupplementalProwConfigFileName = "_prowconfig.yaml"
	// SupplementalPluginConfigFileName is the name of supplemental  plugin config
	// files.
	SupplementalPluginConfigFileName = "_pluginconfig.yaml"
	// PluginConfigFile is the filename where plugins live
	PluginConfigFile = "_plugins.yaml"
	// PluginConfigInRepoPath is the prow plugin config path from release repo
	PluginConfigInRepoPath = "core-services/prow/02_config/" + PluginConfigFile
	// JobConfigInRepoPath is the prowjobs path from release repo
	JobConfigInRepoPath = "ci-operator/jobs"
	// CiopConfigInRepoPath is the ci-operator config path from release repo
	CiopConfigInRepoPath = "ci-operator/config"
	// TemplatesPath is the path of the templates from release repo
	TemplatesPath = "ci-operator/templates"
	// StagingNamespace is the staging namespace in api.ci
	StagingNamespace = "ci-stg"
	// RegistryPath is the path to the multistage step registry
	RegistryPath = "ci-operator/step-registry"
)

Variables

View Source
var (
	SourceTypeLabel string = "pj-rehearse.openshift.io/source-type"

	ChangedPresubmit       SourceType = "changedPresubmit"
	ChangedPeriodic        SourceType = "changedPeriodic"
	ChangedCiopConfig      SourceType = "changedCiopConfig"
	ChangedClusterProfile  SourceType = "changedClusterProfile"
	ChangedTemplate        SourceType = "changedTemplate"
	ChangedRegistryContent SourceType = "changedRegistryContent"
	Unknown                SourceType = "unknownSource"
)
View Source
var ProwgenFile = ".config.prowgen"

ProwgenFile is the name of prowgen's configuration file.

Functions

func ConfigMapName

func ConfigMapName(path string, updater plugins.ConfigUpdater) (name, pattern string, err error)

ConfigMapName returns the name of the ConfigMap to which config-updater would put the content, and the config-updater config pattern that covers the path of the ConfigMap source.

func GetAddedConfigs

func GetAddedConfigs(path, baseRev string) ([]string, error)

func GetChangedRegistrySteps

func GetChangedRegistrySteps(path, baseRev string, graph registry.NodeByName) ([]registry.Node, error)

GetChangedRegistrySteps identifies all registry components that changed.

func GetChangedTemplates

func GetChangedTemplates(path, baseRev string) ([]string, error)

func LoadProwConfig

func LoadProwConfig(releaseRepo string) (*prowconfig.Config, error)

LoadProwConfig loads Prow configuration from the release repo

func LoggerForInfo

func LoggerForInfo(info Info) *logrus.Entry

func NewLocalJobSpec

func NewLocalJobSpec(path string) (*pjdwapi.JobSpec, error)

NewLocalJobSpec creates a fake JobSpec based on information extracted from the local git repository to simulate a CI job.

func OperateOnCIOperatorConfig

func OperateOnCIOperatorConfig(path string, callback ConfigIterFunc) error

OperateOnCIOperatorConfig runs the callback on the parsed data from the CI Operator configuration file provided

func OperateOnCIOperatorConfigDir

func OperateOnCIOperatorConfigDir(configDir string, callback ConfigIterFunc) error

OperateOnCIOperatorConfigDir runs the callback on all CI Operator configuration files found while walking the directory provided

func OperateOnCIOperatorConfigPaths

func OperateOnCIOperatorConfigPaths(path string, callback InfoIterFunc) error

func OperateOnCIOperatorConfigSubdir

func OperateOnCIOperatorConfigSubdir(configDir, subDir string, callback ConfigIterFunc) error

func ProwConfigForOrgRepo

func ProwConfigForOrgRepo(releaseRepo, org, repo string) string

ProwConfigForOrgRepo returns the Prow configuration file for the org/repo

Types

type ByFilename

ByFilename stores CI Operator configurations with their metadata by filename

func LoadByFilename

func LoadByFilename(path string) (ByFilename, error)

type ByOrgRepo

ByOrgRepo maps org --> repo --> list of branched and variant configs

func LoadByOrgRepo

func LoadByOrgRepo(path string) (ByOrgRepo, error)

type ConfirmableOptions

type ConfirmableOptions struct {
	Options

	Confirm bool
}

func (*ConfirmableOptions) Bind

func (o *ConfirmableOptions) Bind(fs *flag.FlagSet)

func (*ConfirmableOptions) Validate

func (o *ConfirmableOptions) Validate() error

type DataByFilename

type DataByFilename map[string]DataWithInfo

DataByFilename stores CI Operator configurations with their metadata by filename

func LoadDataByFilename

func LoadDataByFilename(path string) (DataByFilename, error)

type DataWithInfo

type DataWithInfo struct {
	Configuration cioperatorapi.ReleaseBuildConfiguration
	Info          Info
}

DataWithInfo wraps a CI Operator configuration and metadata for it

func (*DataWithInfo) CommitTo

func (i *DataWithInfo) CommitTo(dir string) error

func (*DataWithInfo) Logger

func (i *DataWithInfo) Logger() *logrus.Entry

type Info

type Info struct {
	cioperatorapi.Metadata
	// Filename is the full path to the file on disk
	Filename string
	// OrgPath is the full path to the directory containing config for the org
	OrgPath string
	// RepoPath is the full path to the directory containing config for the repo
	RepoPath string
}

Info describes the metadata for a CI Operator configuration file along with where it's loaded from

func InfoFromPath

func InfoFromPath(configFilePath string) (*Info, error)

We use the directory/file naming convention to encode useful information about component repository information. The convention for ci-operator config files in this repo: ci-operator/config/ORGANIZATION/COMPONENT/ORGANIZATION-COMPONENT-BRANCH.yaml

func (*Info) LogFields

func (i *Info) LogFields() logrus.Fields

type InfoIterFunc

type InfoIterFunc func(string, *Info) error

type Options

type Options struct {
	ConfigDir string
	Org       string
	Repo      string

	LogLevel string
	// contains filtered or unexported fields
}

Options holds options to load CI Operator configuration and select a subset of that configuration to operate on. Configurations can be filtered by --org, --repo, or both.

func (*Options) Bind

func (o *Options) Bind(fs *flag.FlagSet)

func (*Options) Complete

func (o *Options) Complete() error

func (*Options) OperateOnCIOperatorConfigDir

func (o *Options) OperateOnCIOperatorConfigDir(configDir string, callback func(*cioperatorapi.ReleaseBuildConfiguration, *Info) error) error

OperateOnCIOperatorConfigDir filters the full set of configurations down to those that were selected by the user with --{org|repo}

func (*Options) OperateOnJobConfigSubdirPaths

func (o *Options) OperateOnJobConfigSubdirPaths(dir, subDir string, knownInfraJobFiles sets.Set[string], callback func(info *jc.Info) error) error

OperateOnJobConfigSubdirPaths filters the full set of configurations down to those that were selected by the user with --{org|repo}

func (*Options) ProcessAll

func (o *Options) ProcessAll() bool

func (*Options) Validate

func (o *Options) Validate() error

type Periodics

type Periodics map[string]prowconfig.Periodic

func (Periodics) Add

func (p Periodics) Add(job prowconfig.Periodic, sourceType SourceType)

Add adds a job from a different instance. The method assumes two jobs with a matching name are identical, so if a periodic with a given name already exists, it is overridden.

func (Periodics) AddAll

func (p Periodics) AddAll(jobs Periodics, sourceType SourceType)

AddAll adds all jobs from a different instance. The method assumes two jobs with a matching name are identical, so if a periodic with a given name already exists, it is overridden.

type Presubmits

type Presubmits map[string][]prowconfig.Presubmit

func (Presubmits) Add

func (p Presubmits) Add(repo string, job prowconfig.Presubmit, sourceType SourceType)

Add a presubmit for a given repo. The method assumes two jobs with a matching name are identical, so if a presubmit with a given name already exists, it is kept as is.

func (Presubmits) AddAll

func (p Presubmits) AddAll(jobs Presubmits, sourceType SourceType)

AddAll adds all jobs from a different instance. The method assumes two jobs with a matching name for the same repository are identical, so if a presubmit with a given name already exists, it is kept as is.

type Prowgen

type Prowgen struct {
	// Private indicates that generated jobs should be marked as hidden
	// from display in deck and that they should mount appropriate git credentials
	// to clone the repository under test.
	Private bool `json:"private,omitempty"`
	// Expose declares that jobs should not be hidden from view in deck if they
	// are private.
	// This field has no effect if private is not set.
	Expose bool `json:"expose,omitempty"`
	// Rehearsals declares any disabled rehearsals for jobs
	Rehearsals Rehearsals `json:"rehearsals,omitempty"`
	// SlackReporterConfigs defines all desired slack reporter info for included jobs
	SlackReporterConfigs []SlackReporterConfig `json:"slack_reporter,omitempty"`
}

Prowgen holds the information of the prowgen's configuration file.

func LoadProwgenConfig

func LoadProwgenConfig(folder string) (*Prowgen, error)

func (*Prowgen) GetSlackReporterConfigForTest

func (p *Prowgen) GetSlackReporterConfigForTest(test, variant string) *SlackReporterConfig

func (*Prowgen) MergeDefaults

func (p *Prowgen) MergeDefaults(defaults *Prowgen)

type Rehearsals

type Rehearsals struct {
	// DisableAll indicates that all jobs will not have their "can-be-rehearsed" label set
	// and therefore will not be picked up for rehearsals.
	DisableAll bool `json:"disable_all,omitempty"`
	// DisabledRehearsals contains a list of jobs that will not have their "can-be-rehearsed" label set
	// and therefore will not be picked up for rehearsals.
	DisabledRehearsals []string `json:"disabled_rehearsals,omitempty"`
}

type ReleaseRepoConfig

type ReleaseRepoConfig struct {
	Prow       *prowconfig.Config
	CiOperator DataByFilename
}

ReleaseRepoConfig contains all configuration present in release repo (usually openshift/release)

func GetAllConfigs

func GetAllConfigs(releaseRepoPath string) (*ReleaseRepoConfig, error)

GetAllConfigs loads all configuration from the working copy of the release repo (usually openshift/release). When an error occurs during some config loading, the error will be propagated, however the returned struct field will also have a nil value in the appropriate field.

func GetAllConfigsFromSHA

func GetAllConfigsFromSHA(releaseRepoPath, sha string) (*ReleaseRepoConfig, error)

GetAllConfigsFromSHA loads all configuration from given SHA revision of the release repo (usually openshift/release). This method checks out the given revision before the configuration is loaded, and then checks out back the saved revision that was checked out in the working copy when this method was called. Errors occurred during these git manipulations are propagated in the error return value. Errors occurred during the actual config loading are not propagated, but the returned struct field will have a nil value in the appropriate field. The error is only logged.

type SlackReporterConfig

type SlackReporterConfig struct {
	Channel           string                `json:"channel,omitempty"`
	JobStatesToReport []prowv1.ProwJobState `json:"job_states_to_report,omitempty"`
	ReportTemplate    string                `json:"report_template,omitempty"`
	JobNames          []string              `json:"job_names,omitempty"`
	// ExcludedVariants lists job variants that this config will not apply to
	ExcludedVariants []string `json:"excluded_variants,omitempty"`
}

SlackReporterConfig groups test names to a channel to report; mimicking Prow's version, with some unnecessary fields removed

type SourceType

type SourceType string

func GetSourceType

func GetSourceType(labels map[string]string) SourceType

func (SourceType) GetDisplayText

func (sourceType SourceType) GetDisplayText() string

type WhitelistConfig

type WhitelistConfig struct {
	Whitelist map[string][]string `json:"whitelist,omitempty"`
}

WhitelistConfig holds a list of repositories mapped by organization

func (*WhitelistConfig) IsWhitelisted

func (w *WhitelistConfig) IsWhitelisted(info *Info) bool

type WhitelistOptions

type WhitelistOptions struct {
	WhitelistConfig WhitelistConfig
	// contains filtered or unexported fields
}

WhitelistOptions holds the required flags to load the whitelist configuration

func (*WhitelistOptions) Bind

func (o *WhitelistOptions) Bind(fs *flag.FlagSet)

func (*WhitelistOptions) Validate

func (o *WhitelistOptions) Validate() error

Validate validates if the whitelist cofiguration file actual exists.

Jump to

Keyboard shortcuts

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