Documentation ¶
Index ¶
- Constants
- Variables
- func BundleSourceStep(config api.BundleSourceStepConfiguration, ...) api.Step
- func ClusterClaimStep(as string, clusterClaim *api.ClusterClaim, ...) api.Step
- func GenerateBasePod(jobSpec *api.JobSpec, baseLabels map[string]string, name string, ...) (*coreapi.Pod, error)
- func GitSourceStep(config api.ProjectDirectoryImageBuildInputs, ...) api.Step
- func IPPoolStep(client *lease.Client, secretClient SecretClient, lease api.StepLease, ...) api.Step
- func ImagesReadyStep(links []api.StepLink) api.Step
- func IndexGeneratorStep(config api.IndexGeneratorStepConfiguration, ...) api.Step
- func InputEnvironmentStep(name string, values map[string]string, links []api.StepLink) api.Step
- func InputImageTagStep(config *api.InputImageTagStepConfiguration, client loggingclient.LoggingClient, ...) api.Step
- func LabelsFor(spec *api.JobSpec, base map[string]string, ref string) map[string]string
- func LeaseStep(client *lease.Client, leases []api.StepLease, wrapped api.Step, ...) api.Step
- func NamePerTest(name, testName string) string
- func OutputImageTagStep(config api.OutputImageTagStepConfiguration, client loggingclient.LoggingClient, ...) api.Step
- func PipelineImageCacheStep(config api.PipelineImageCacheStepConfiguration, ...) api.Step
- func PodStep(name string, config PodStepConfiguration, resources api.ResourceConfiguration, ...) api.Step
- func ProjectDirectoryImageBuildStep(config api.ProjectDirectoryImageBuildStepConfiguration, ...) api.Step
- func RPMImageInjectionStep(config api.RPMImageInjectionStepConfiguration, ...) api.Step
- func RPMServerStep(config api.RPMServeStepConfiguration, client loggingclient.LoggingClient, ...) api.Step
- func ResourcesFor(req api.ResourceRequirements) (corev1.ResourceRequirements, error)
- func Run(ctx context.Context, graph api.StepGraph) (*junit.TestSuites, []api.CIOperatorStepDetails, []error)
- func RunPod(ctx context.Context, podClient kubernetes.PodClient, pod *coreapi.Pod) (*coreapi.Pod, error)
- func SourceStep(config api.SourceStepConfiguration, resources api.ResourceConfiguration, ...) api.Step
- func TemplateExecutionStep(template *templateapi.Template, params api.Parameters, ...) api.Step
- func TestStep(config api.TestStepConfiguration, resources api.ResourceConfiguration, ...) api.Step
- func WriteParametersStep(params *api.DeferredParameters, paramFile string) api.Step
- type ArtifactWorker
- type BuildClient
- type CloneAuthConfig
- type CloneAuthType
- type GeneratePodOptions
- type ImageBuildOptions
- type PodStepConfiguration
- type SecretClient
- type SubStepReporter
- type SubtestReporter
- type TemplateClient
- type TestCaseNotifier
Constants ¶
const ( RPMRepoName = "rpm-repo" AppLabel = "app" TTLIgnoreLabel = "ci.openshift.io/ttl.ignore" )
const ( CiAnnotationPrefix = "ci.openshift.io" CreatesLabel = "creates" CreatedByCILabel = "created-by-ci" ProwJobIdLabel = "prow.k8s.io/id" OauthSecretKey = "oauth-token" )
const ( LabelMetadataOrg = "ci.openshift.io/metadata.org" LabelMetadataRepo = "ci.openshift.io/metadata.repo" LabelMetadataBranch = "ci.openshift.io/metadata.branch" LabelMetadataVariant = "ci.openshift.io/metadata.variant" LabelMetadataTarget = "ci.openshift.io/metadata.target" LabelMetadataStep = "ci.openshift.io/metadata.step" LabelJobID = "ci.openshift.io/jobid" LabelJobType = "ci.openshift.io/jobtype" LabelJobName = "ci.openshift.io/jobname" )
const ( RefsOrgLabel = "ci.openshift.io/refs.org" RefsRepoLabel = "ci.openshift.io/refs.repo" RefsBranchLabel = "ci.openshift.io/refs.branch" RefsVariantLabel = "ci.openshift.io/refs.variant" JobNameLabel = "ci.openshift.io/job" MultiStageStepNameLabel = "ci.openshift.io/step" TestContainerName = "test" )
const ( // A boolean value which indicates that the logs from all containers in the // pod must be copied to the artifact directory (default is "false"). AnnotationSaveContainerLogs = "ci-operator.openshift.io/save-container-logs" )
const IndexDataDirectory = "/index-data"
const IndexDockerfileName = "index.Dockerfile"
const UnusedIpCount = "UNUSED_IP_COUNT"
Variables ¶
var CleanupCtx = context.Background()
CleanupCtx is used by steps when the primary context is cancelled. When we're cleaning up, we need a context to use for client calls, but we cannot use the normal context we have in steps, as that may be cancelled (and that would be why we're cleaning up in the first place). This is intended only for internal usage of this package and its sub-packages.
var (
JobSpecAnnotation = fmt.Sprintf("%s/%s", CiAnnotationPrefix, "job-spec")
)
var NoHiveClientErr = errors.New("step claims a cluster without providing a Hive client")
var NoLeaseClientErr = errors.New("step needs a lease but no lease client provided")
var NoLeaseClientForIPErr = errors.New("step needs access to an IP pool, but no lease client provided")
Functions ¶
func BundleSourceStep ¶
func BundleSourceStep( config api.BundleSourceStepConfiguration, releaseBuildConfig *api.ReleaseBuildConfiguration, resources api.ResourceConfiguration, client BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, pullSecret *coreapi.Secret, ) api.Step
func ClusterClaimStep ¶
func ClusterClaimStep(as string, clusterClaim *api.ClusterClaim, hiveClient ctrlruntimeclient.WithWatch, client loggingclient.LoggingClient, jobSpec *api.JobSpec, wrapped api.Step, censor *secrets.DynamicCensor) api.Step
func GenerateBasePod ¶
func GenerateBasePod( jobSpec *api.JobSpec, baseLabels map[string]string, name string, nodeName string, containerName string, command []string, image string, containerResources coreapi.ResourceRequirements, artifactDir string, decorationConfig *v1.DecorationConfig, rawJobSpec string, secretsToCensor []coreapi.VolumeMount, generatePodOptions *GeneratePodOptions, ) (*coreapi.Pod, error)
func GitSourceStep ¶
func GitSourceStep( config api.ProjectDirectoryImageBuildInputs, resources api.ResourceConfiguration, buildClient BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, cloneAuthConfig *CloneAuthConfig, pullSecret *coreapi.Secret, ) api.Step
GitSourceStep returns gitSourceStep that holds all the required information to create a build from a git source.
func IPPoolStep ¶
func IndexGeneratorStep ¶
func IndexGeneratorStep( config api.IndexGeneratorStepConfiguration, releaseBuildConfig *api.ReleaseBuildConfiguration, resources api.ResourceConfiguration, buildClient BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, pullSecret *coreapi.Secret, ) api.Step
func InputEnvironmentStep ¶
InputEnvironmentStep acts as a shim for a given step, taking a precalculated set of inputs and returning those when executed. May be used to substitute a step that does work with another that simply reports output.
func InputImageTagStep ¶
func InputImageTagStep( config *api.InputImageTagStepConfiguration, client loggingclient.LoggingClient, jobSpec *api.JobSpec) api.Step
func NamePerTest ¶
func OutputImageTagStep ¶
func OutputImageTagStep(config api.OutputImageTagStepConfiguration, client loggingclient.LoggingClient, jobSpec *api.JobSpec) api.Step
func PipelineImageCacheStep ¶
func PipelineImageCacheStep( config api.PipelineImageCacheStepConfiguration, resources api.ResourceConfiguration, client BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, pullSecret *coreapi.Secret, ) api.Step
func PodStep ¶
func PodStep(name string, config PodStepConfiguration, resources api.ResourceConfiguration, client kubernetes.PodClient, jobSpec *api.JobSpec, clusterClaim *api.ClusterClaim) api.Step
func ProjectDirectoryImageBuildStep ¶
func ProjectDirectoryImageBuildStep( config api.ProjectDirectoryImageBuildStepConfiguration, releaseBuildConfig *api.ReleaseBuildConfiguration, resources api.ResourceConfiguration, buildClient BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, pullSecret *coreapi.Secret, ) api.Step
func RPMImageInjectionStep ¶
func RPMImageInjectionStep( config api.RPMImageInjectionStepConfiguration, resources api.ResourceConfiguration, buildClient BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, pullSecret *coreapi.Secret, ) api.Step
func RPMServerStep ¶
func RPMServerStep( config api.RPMServeStepConfiguration, client loggingclient.LoggingClient, jobSpec *api.JobSpec) api.Step
func ResourcesFor ¶
func ResourcesFor(req api.ResourceRequirements) (corev1.ResourceRequirements, error)
func Run ¶
func Run(ctx context.Context, graph api.StepGraph) (*junit.TestSuites, []api.CIOperatorStepDetails, []error)
func RunPod ¶
func RunPod(ctx context.Context, podClient kubernetes.PodClient, pod *coreapi.Pod) (*coreapi.Pod, error)
RunPod may be used to run a pod to completion. Provides a simpler interface than PodStep and is intended for other steps that may need to run transient actions. This pod will not be able to gather artifacts, nor will it report log messages unless it fails.
func SourceStep ¶
func SourceStep( config api.SourceStepConfiguration, resources api.ResourceConfiguration, buildClient BuildClient, podClient kubernetes.PodClient, jobSpec *api.JobSpec, cloneAuthConfig *CloneAuthConfig, pullSecret *corev1.Secret, ) api.Step
func TemplateExecutionStep ¶
func TemplateExecutionStep(template *templateapi.Template, params api.Parameters, podClient kubernetes.PodClient, templateClient TemplateClient, jobSpec *api.JobSpec, resources api.ResourceConfiguration) api.Step
func TestStep ¶
func TestStep(config api.TestStepConfiguration, resources api.ResourceConfiguration, client kubernetes.PodClient, jobSpec *api.JobSpec, nodeName string) api.Step
func WriteParametersStep ¶
func WriteParametersStep(params *api.DeferredParameters, paramFile string) api.Step
Types ¶
type ArtifactWorker ¶
type ArtifactWorker struct {
// contains filtered or unexported fields
}
ArtifactWorker tracks pods that have completed and have an 'artifacts' container in them and will extract files from the container to a local directory. It also gathers container logs on all pods.
This worker is thread safe and may be invoked in parallel.
func NewArtifactWorker ¶
func NewArtifactWorker(podClient kubernetes.PodClient, artifactDir, namespace string) *ArtifactWorker
func (*ArtifactWorker) CollectFromPod ¶
func (w *ArtifactWorker) CollectFromPod(podName string, hasArtifacts []string, waitForContainers []string)
func (*ArtifactWorker) Complete ¶
func (w *ArtifactWorker) Complete(podName string)
func (*ArtifactWorker) Done ¶
func (w *ArtifactWorker) Done(podName string) <-chan struct{}
type BuildClient ¶
type BuildClient interface { loggingclient.LoggingClient Logs(namespace, name string, options *buildapi.BuildLogOptions) (io.ReadCloser, error) NodeArchitectures() []string ManifestToolDockerCfg() string LocalRegistryDNS() string }
func NewBuildClient ¶
func NewBuildClient(client loggingclient.LoggingClient, restClient rest.Interface, nodeArchitectures []string, manifestToolDockerCfg, localRegistryDNS string) BuildClient
type CloneAuthConfig ¶
type CloneAuthConfig struct { Secret *corev1.Secret Type CloneAuthType }
type CloneAuthType ¶
type CloneAuthType string
var ( CloneAuthTypeSSH CloneAuthType = "SSH" CloneAuthTypeOAuth CloneAuthType = "OAuth" )
type GeneratePodOptions ¶
type ImageBuildOptions ¶
type ImageBuildOptions struct {
Architectures []string
}
type PodStepConfiguration ¶
type PodStepConfiguration struct { WaitFlags util.WaitForPodFlag As string From api.ImageStreamTagReference Commands string Labels map[string]string NodeName string ServiceAccountName string Secrets []*api.Secret MemoryBackedVolume *api.MemoryBackedVolume Clone bool NodeArchitecture api.NodeArchitecture }
PodStepConfiguration allows other steps to reuse the pod launching and monitoring behavior without reimplementing function. It also enforces conventions like naming, directory structure, and input image format. More sophisticated reuse of launching pods should use RunPod which is more limited.
type SecretClient ¶
type SecretClient interface {
Get(ctx context.Context, key ctrlruntimeclient.ObjectKey, obj ctrlruntimeclient.Object, opts ...ctrlruntimeclient.GetOption) error
}
type SubStepReporter ¶
type SubStepReporter interface {
SubSteps() []api.CIOperatorStepDetailInfo
}
SubStepReporter allows steps to report substeps. TODO: Should this be merged with the SubtestReporter?
type SubtestReporter ¶
SubtestReporter may be implemented by steps that can return an optional set of additional JUnit tests to report to the cluster.
type TemplateClient ¶
type TemplateClient interface { loggingclient.LoggingClient Process(namespace string, template *templateapi.Template) (*templateapi.Template, error) }
func NewTemplateClient ¶
func NewTemplateClient(client loggingclient.LoggingClient, restClient rest.Interface) TemplateClient
type TestCaseNotifier ¶
type TestCaseNotifier struct {
// contains filtered or unexported fields
}
TestCaseNotifier allows a caller to generate per container JUnit test reports that provide better granularity for debugging problems when running tests in multi-container pods. It intercepts notifications and remembers the last pod retrieved which SubTests() will read.
TestCaseNotifier must be called from a single thread.
func NewTestCaseNotifier ¶
func NewTestCaseNotifier(nested util.ContainerNotifier) *TestCaseNotifier
NewTestCaseNotifier wraps the provided ContainerNotifier and will create JUnit TestCase records for each container in the most recent pod to have completed.
func (*TestCaseNotifier) Complete ¶
func (n *TestCaseNotifier) Complete(podName string)
func (*TestCaseNotifier) Done ¶
func (n *TestCaseNotifier) Done(podName string) <-chan struct{}
func (*TestCaseNotifier) Notify ¶
func (n *TestCaseNotifier) Notify(pod *coreapi.Pod, containerName string)
func (*TestCaseNotifier) SubTests ¶
func (n *TestCaseNotifier) SubTests(prefix string) []*junit.TestCase
SubTests returns one junit test for each terminated container with a name in the annotation 'ci-operator.openshift.io/container-sub-tests' in the pod. Invoking SubTests clears the last pod, so subsequent calls will return no tests unless Notify() has been called in the meantime.
Source Files ¶
- artifacts.go
- build_client.go
- bundle_source.go
- cluster_claim.go
- git_source.go
- images_ready.go
- index_generator.go
- input_env.go
- input_image_tag.go
- ip_pool.go
- lease.go
- output_image_tag.go
- pipeline_image_cache.go
- pod.go
- project_image.go
- rpm_injection.go
- rpm_server.go
- run.go
- source.go
- template.go
- write_params.go