decorate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package decorate is a library for adding to a user-provided PodSpec in order to create a full Pod that will fulfill a test job

Index

Constants

View Source
const (
	// RequirePassingEntries causes sidecar to return an error if any entry fails. Otherwise it exits cleanly so long as it can complete.
	RequirePassingEntries = true
)

Variables

This section is empty.

Functions

func BlobStorageOptions

func BlobStorageOptions(dc prowapi.DecorationConfig, localMode bool) ([]coreapi.Volume, []coreapi.VolumeMount, gcsupload.Options)

func CloneLogPath

func CloneLogPath(logMount coreapi.VolumeMount) string

CloneLogPath returns the path to the clone log file in the volume mount. CloneLogPath returns the path to the clone log file in the volume mount.

func CloneRefs

func CloneRefs(pj prowapi.ProwJob, codeMount, logMount coreapi.VolumeMount) (*coreapi.Container, []prowapi.Refs, []coreapi.Volume, error)

CloneRefs constructs the container and volumes necessary to clone the refs requested by the ProwJob.

The container checks out repositories specified by the ProwJob Refs to `codeMount`. A log of what it checked out is written to `clone.json` in `logMount`.

The container may need to mount SSH keys and/or cookiefiles in order to access private refs. CloneRefs returns a list of volumes containing these secrets required by the container.

func CodeMountAndVolume

func CodeMountAndVolume() (coreapi.VolumeMount, coreapi.Volume)

CodeMountAndVolume returns the canonical volume and mount used to share code under test

func DetermineWorkDir

func DetermineWorkDir(baseDir string, refs []prowapi.Refs) string

DetermineWorkDir determines the working directory to use for a given set of refs to clone

func InitUpload

func InitUpload(config *prowapi.DecorationConfig, gcsOptions gcsupload.Options, blobStorageMounts []coreapi.VolumeMount, cloneLogMount *coreapi.VolumeMount, outputMount *coreapi.VolumeMount, encodedJobSpec string) (*coreapi.Container, error)

func InjectEntrypoint

func InjectEntrypoint(c *coreapi.Container, timeout, gracePeriod time.Duration, prefix, previousMarker string, exitZero bool, log, tools coreapi.VolumeMount) (*wrapper.Options, error)

InjectEntrypoint will make the entrypoint binary in the tools volume the container's entrypoint, which will output to the log volume.

func KubeEnv

func KubeEnv(environment map[string]string) []coreapi.EnvVar

KubeEnv transforms a mapping of environment variables into their serialized form for a PodSpec, sorting by the name of the env vars

func Labels

func Labels() []string

Labels returns a string slice with label consts from kube.

func LabelsAndAnnotationsForJob

func LabelsAndAnnotationsForJob(pj prowapi.ProwJob) (map[string]string, map[string]string)

LabelsAndAnnotationsForJob returns a standard set of labels to add to pod/build/etc resources.

func LabelsAndAnnotationsForSpec

func LabelsAndAnnotationsForSpec(spec prowapi.ProwJobSpec, extraLabels, extraAnnotations map[string]string) (map[string]string, map[string]string)

LabelsAndAnnotationsForSpec returns a minimal set of labels to add to prowjobs or its owned resources.

User-provided extraLabels and extraAnnotations values will take precedence over auto-provided values.

func LogMountAndVolume

func LogMountAndVolume() (coreapi.VolumeMount, coreapi.Volume)

LogMountAndVolume returns the canonical volume and mount used to persist container logs.

func PlaceEntrypoint

func PlaceEntrypoint(config *prowapi.DecorationConfig, toolsMount coreapi.VolumeMount) coreapi.Container

PlaceEntrypoint will copy entrypoint from the entrypoint image to the tools volume

func PodUtilsContainerNames

func PodUtilsContainerNames() sets.String

PodUtilsContainerNames returns a string set with pod utility container name consts in it.

func ProwJobToPod

func ProwJobToPod(pj prowapi.ProwJob) (*coreapi.Pod, error)

ProwJobToPod converts a ProwJob to a Pod that will run the tests.

func ProwJobToPodLocal

func ProwJobToPodLocal(pj prowapi.ProwJob, outputDir string) (*coreapi.Pod, error)

ProwJobToPodLocal converts a ProwJob to a Pod that will run the tests. If an output directory is specified, files are copied to the dir instead of uploading to GCS if decoration is configured.

func Sidecar

func Sidecar(config *prowapi.DecorationConfig, gcsOptions gcsupload.Options, blobStorageMounts []coreapi.VolumeMount, logMount coreapi.VolumeMount, outputMount *coreapi.VolumeMount, encodedJobSpec string, requirePassingEntries, ignoreInterrupts bool, secretVolumeMounts []coreapi.VolumeMount, wrappers ...wrapper.Options) (*coreapi.Container, error)

func ToolsMountAndVolume

func ToolsMountAndVolume() (coreapi.VolumeMount, coreapi.Volume)

ToolsMountAndVolume returns the canonical volume and mount used to propagate the entrypoint

func VolumeMountPathsOnTestContainer

func VolumeMountPathsOnTestContainer() sets.String

VolumeMountPathsOnTestContainer returns a string set with *MountPath consts in it which are applied to the test container.

func VolumeMounts

func VolumeMounts(dc *prowapi.DecorationConfig) sets.String

VolumeMounts returns a string set with *MountName consts in it.

func VolumeMountsOnTestContainer

func VolumeMountsOnTestContainer() sets.String

VolumeMountsOnTestContainer returns a string set with *MountName consts in it which are applied to the test container.

Types

This section is empty.

Jump to

Keyboard shortcuts

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