prowgen

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 (
	Generator jc.Generator = "prowgen"
)

Variables

This section is empty.

Functions

func GenerateJobs

func GenerateJobs(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo) (*prowconfig.JobConfig, error)

GenerateJobs Given a ci-operator configuration file and basic information about what should be tested, generate a following JobConfig:

  • one presubmit for each test defined in config file
  • if the config file has non-empty `images` section, generate an additional presubmit and postsubmit that has `--target=[images]`. This postsubmit will additionally pass `--promote` to ci-operator

All these generated jobs will be labeled as "newly generated". After all new jobs are generated with GenerateJobs, the call site should also use Prune() function to remove all stale jobs and label the jobs as simply "generated".

func GeneratePeriodicForTest

func GeneratePeriodicForTest(jobBaseBuilder *prowJobBaseBuilder, info *ProwgenInfo, options ...GeneratePeriodicOption) *prowconfig.Periodic

func NewProwJobBaseBuilder

func NewProwJobBaseBuilder(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo, podSpecGenerator CiOperatorPodSpecGenerator) *prowJobBaseBuilder

NewProwJobBaseBuilder returns a new builder instance populated with defaults from the given ReleaseBuildConfiguration, Prowgen config. The embedded PodSpec is built using an injected CiOperatorPodSpecGenerator, not directly. The embedded PodSpec is not built until the Build method is called.

func NewProwJobBaseBuilderForTest

func NewProwJobBaseBuilderForTest(configSpec *cioperatorapi.ReleaseBuildConfiguration, info *ProwgenInfo, podSpecGenerator CiOperatorPodSpecGenerator, test cioperatorapi.TestStepConfiguration) *prowJobBaseBuilder

NewProwJobBaseBuilderForTest creates a new builder populated with defaults for the given ci-operator test. The resulting builder is a superset of a one built by NewProwJobBaseBuilder, with additional fields set for test

Types

type CiOperatorPodSpecGenerator

type CiOperatorPodSpecGenerator interface {
	// Add adds one or more mutations to be performed to build the final PodSpec
	Add(mutators ...PodSpecMutator) CiOperatorPodSpecGenerator
	// Build returns the PodSpec built by taking the default PodSpec, applying
	// all added mutators and sorting several list fields by their keys.
	Build() (*corev1.PodSpec, error)
	// MustBuild is same as Build but panics whenever an error would be reported
	MustBuild() *corev1.PodSpec
}

CiOperatorPodSpecGenerator is a builder-pattern for building PodSpecs that run ci-operator for various purposes, ensuring the consistency of volumes, mounts, parameters and other content.

func NewCiOperatorPodSpecGenerator

func NewCiOperatorPodSpecGenerator() CiOperatorPodSpecGenerator

NewCiOperatorPodSpecGenerator returns a new CiOperatorPodSpecGenerator instance

type GeneratePeriodicOption

type GeneratePeriodicOption func(options *GeneratePeriodicOptions)

type GeneratePeriodicOptions

type GeneratePeriodicOptions struct {
	Interval          string
	MinimumInterval   string
	Cron              string
	ReleaseController bool
	PathAlias         *string
	DisableRehearsal  bool
}

type PodSpecMutator

type PodSpecMutator func(spec *corev1.PodSpec) error

PodSpecMutator is a mutation function operating over a PodSpec pointer. The changes performed on the PodSpec must not depend on any previous state of the PodSpec, and must resolve any conflicts it encounters. The mutator function must also correctly handle being called multiple calls

func CIPullSecret

func CIPullSecret() PodSpecMutator

CIPullSecret exposes a shared CI pull secret via a mounted volume and a `--secret-dir` option passed to ci-operator

func Claims

func Claims() PodSpecMutator

Claims configures ci-operator to be able to interact with the Hive cluster for tests that use Claims, providing the necessary secrets to do so

func ClusterProfile

func ClusterProfile(profile cioperatorapi.ClusterProfile, target string) PodSpecMutator

ClusterProfile exposes the configured cluster profile to ci-operator via a mounted volume

func CustomHashInput

func CustomHashInput(input string) PodSpecMutator

func GitHubToken

func GitHubToken(reuseDecorationVolume bool) PodSpecMutator

GitHubToken configures ci-operator to use a GH token to authenticate to GitHub (to be able to get source code from GitHub repositories). The necessary secret is made available in a volume that may be provided by Prow already: in this case that volume must be reused instead of added to the PodSpec.

func InjectTestFrom

func InjectTestFrom(source *cioperatorapi.MetadataWithTest) PodSpecMutator

InjectTestFrom configures ci-operator to inject the specified test from the specified ci-operator config into the base config and target it

func LeaseClient

func LeaseClient() PodSpecMutator

LeaseClient configures ci-operator to be able to interact with Boskos (lease server), providing the necessary secrets to do so

func OverrideImage

func OverrideImage(name, tag string) PodSpecMutator

OverrideImage sets the "OVERRIDE_IMAGE_*" env var in order to override the respective image with the provided tag

func Promotion

func Promotion() PodSpecMutator

Promotion configures the PodSpec to run ci-operator in a promoting mode, supplying the necessary secrets and the ci-operator parameter

func ReleaseInitial

func ReleaseInitial(pullspec string) PodSpecMutator

ReleaseInitial sets the "RELEASE_IMAGE_INITIAL" env var in order to override the "initial" pullspec

func ReleaseLatest

func ReleaseLatest(pullspec string) PodSpecMutator

ReleaseLatest sets the "RELEASE_IMAGE_LATEST" env var in order to override the "latest" pullspec

func ReleaseRpms

func ReleaseRpms(version string, meta cioperatorapi.Metadata) PodSpecMutator

ReleaseRpms adds environment variables that expose OCP release RPMs needed by several template-based tests. Does not have any effect when the generator is not configured to produce a template test (see `Template`)

func Secrets

func Secrets(secrets ...*cioperatorapi.Secret) PodSpecMutator

Secrets exposes the configured secrets via mounted volumes and a `--secret-dir` option passed to ci-operator

func TargetAdditionalSuffix

func TargetAdditionalSuffix(suffix string) PodSpecMutator

func Targets

func Targets(targets ...string) PodSpecMutator

Targets configures ci-operator to build specified targets

func Template

func Template(template, command, fromImage, target string, profile cioperatorapi.ClusterProfile) PodSpecMutator

Template exposes the configured template to ci-operator via a mounted volume, and configures the environment variables consumed by the templates fromImage can be empty. If it is not empty, it configures an environmental variable holding the test image ImageStreamTag (only used by the custom image test template) Template() also implies and includes a corresponding ClusterProfile() mutator.

func Variant

func Variant(variant string) PodSpecMutator

type ProwgenInfo

type ProwgenInfo struct {
	cioperatorapi.Metadata
	Config config.Prowgen
}

Jump to

Keyboard shortcuts

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