Documentation ¶
Overview ¶
Package util contains common functions that are used by the rest of the OpenShift build system.
Index ¶
- Constants
- Variables
- func BuildConfigBuilds(c buildlister.BuildLister, namespace, name string, filterFunc buildFilter) ([]*buildapi.Build, error)
- func BuildConfigSelector(name string) labels.Selector
- func BuildNameForConfigVersion(name string, version int) string
- func ConfigNameForBuild(build *buildapi.Build) string
- func CopyApiEnvVarToV1EnvVar(in []kapi.EnvVar) []corev1.EnvVar
- func CopyApiResourcesToV1Resources(in *kapi.ResourceRequirements) corev1.ResourceRequirements
- func FindDockerSecretAsReference(secrets []kapi.Secret, image string) *kapi.LocalObjectReference
- func GetBuildEnv(build *buildapi.Build) []kapi.EnvVar
- func IsBuildComplete(build *buildapi.Build) bool
- func IsTerminalPhase(phase buildapi.BuildPhase) bool
- func MergeTrustedEnvWithoutDuplicates(source []corev1.EnvVar, output *[]corev1.EnvVar, sourcePrecedence bool)
- func ParseProxyURL(proxy string) (*url.URL, error)
- func SetBuildEnv(build *buildapi.Build, env []kapi.EnvVar)
- func UpdateBuildEnv(build *buildapi.Build, env []kapi.EnvVar)
Constants ¶
const ( // NoBuildLogsMessage reports that no build logs are available NoBuildLogsMessage = "No logs are available." // WorkDir is the working directory within the build pod, mounted as a volume. BuildWorkDirMount = "/tmp/build" // BuilderServiceAccountName is the name of the account used to run build pods by default. BuilderServiceAccountName = "builder" )
Variables ¶
var ( // InputContentPath is the path at which the build inputs will be available // to all the build containers. InputContentPath = filepath.Join(BuildWorkDirMount, "inputs") )
Functions ¶
func BuildConfigBuilds ¶ added in v1.3.0
func BuildConfigBuilds(c buildlister.BuildLister, namespace, name string, filterFunc buildFilter) ([]*buildapi.Build, error)
BuildConfigBuilds return a list of builds for the given build config. Optionally you can specify a filter function to select only builds that matches your criteria.
func BuildConfigSelector ¶ added in v1.1.2
BuildConfigSelector returns a label Selector which can be used to find all builds for a BuildConfig.
func BuildNameForConfigVersion ¶ added in v1.0.8
BuildNameForConfigVersion returns the name of the version-th build for the config that has the provided name.
func ConfigNameForBuild ¶ added in v1.1.2
ConfigNameForBuild returns the name of the build config from a build name.
func CopyApiResourcesToV1Resources ¶
func CopyApiResourcesToV1Resources(in *kapi.ResourceRequirements) corev1.ResourceRequirements
func FindDockerSecretAsReference ¶
func FindDockerSecretAsReference(secrets []kapi.Secret, image string) *kapi.LocalObjectReference
FindDockerSecretAsReference looks through a set of k8s Secrets to find one that represents Docker credentials and which contains credentials that are associated with the registry identified by the image. It returns a LocalObjectReference to the Secret, or nil if no match was found.
func GetBuildEnv ¶
GetBuildEnv gets the build strategy environment
func IsBuildComplete ¶ added in v0.5.3
IsBuildComplete returns whether the provided build is complete or not
func IsTerminalPhase ¶
func IsTerminalPhase(phase buildapi.BuildPhase) bool
IsTerminalPhase returns true if the provided phase is terminal
func MergeTrustedEnvWithoutDuplicates ¶
func MergeTrustedEnvWithoutDuplicates(source []corev1.EnvVar, output *[]corev1.EnvVar, sourcePrecedence bool)
MergeTrustedEnvWithoutDuplicates merges two environment lists without having duplicate items in the output list. The source list will be filtered such that only whitelisted environment variables are merged into the output list. If sourcePrecedence is true, keys in the source list will override keys in the output list.
func ParseProxyURL ¶
ParseProxyURL parses a proxy URL and allows fallback to non-URLs like myproxy:80 (for example) which url.Parse no longer accepts in Go 1.8. The logic is copied from net/http.ProxyFromEnvironment to try to maintain backwards compatibility.
func SetBuildEnv ¶
SetBuildEnv replaces the current build environment
Types ¶
This section is empty.