util

package
v3.7.0-alpha.1+incompa... Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package util contains common functions that are used by the rest of the OpenShift build system.

Index

Constants

View Source
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"
)

Variables

View Source
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

func BuildConfigSelector(name string) labels.Selector

BuildConfigSelector returns a label Selector which can be used to find all builds for a BuildConfig.

func BuildConfigSelectorDeprecated added in v1.1.2

func BuildConfigSelectorDeprecated(name string) labels.Selector

BuildConfigSelectorDeprecated returns a label Selector which can be used to find all builds for a BuildConfig that use the deprecated labels.

func BuildDeepCopy

func BuildDeepCopy(build *buildapi.Build) (*buildapi.Build, error)

func BuildNameForConfigVersion added in v1.0.8

func BuildNameForConfigVersion(name string, version int) string

BuildNameForConfigVersion returns the name of the version-th build for the config that has the provided name.

func BuildNumber added in v1.3.0

func BuildNumber(build *buildapi.Build) (int64, error)

BuildNumber returns the given build number.

func BuildRunPolicy added in v1.3.0

func BuildRunPolicy(build *buildapi.Build) buildapi.BuildRunPolicy

BuildRunPolicy returns the scheduling policy for the build based on the "queued" label.

func ConfigNameForBuild added in v1.1.2

func ConfigNameForBuild(build *buildapi.Build) string

ConfigNameForBuild returns the name of the build config from a build name.

func CopyApiEnvVarToV1EnvVar

func CopyApiEnvVarToV1EnvVar(in []kapi.EnvVar) []v1.EnvVar

func CopyApiResourcesToV1Resources

func CopyApiResourcesToV1Resources(in *kapi.ResourceRequirements) v1.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 GetBuildConfigEnv

func GetBuildConfigEnv(buildConfig *buildapi.BuildConfig) []kapi.EnvVar

GetBuildConfigEnv gets the buildconfig strategy environment

func GetBuildEnv

func GetBuildEnv(build *buildapi.Build) []kapi.EnvVar

GetBuildEnv gets the build strategy environment

func GetBuildName

func GetBuildName(pod metav1.Object) string

GetBuildName returns name of the build pod.

func GetInputReference added in v1.1.4

func GetInputReference(strategy buildapi.BuildStrategy) *kapi.ObjectReference

GetInputReference returns the From ObjectReference associated with the BuildStrategy.

func IsBuildComplete

func IsBuildComplete(build *buildapi.Build) bool

IsBuildComplete returns whether the provided build is complete or not

func IsPaused added in v1.1.2

func IsPaused(bc *buildapi.BuildConfig) bool

IsPaused returns true if the provided BuildConfig is paused and cannot be used to create a new Build

func IsTerminalPhase

func IsTerminalPhase(phase buildapi.BuildPhase) bool

IsTerminalPhase returns true if the provided phase is terminal

func MergeTrustedEnvWithoutDuplicates

func MergeTrustedEnvWithoutDuplicates(source []v1.EnvVar, output *[]v1.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

func ParseProxyURL(proxy string) (*url.URL, error)

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 SafeForLoggingBuild

func SafeForLoggingBuild(build *buildapi.Build) *buildapi.Build

SafeForLoggingBuild returns a copy of a Build with proxy credentials redacted.

func SafeForLoggingBuildCommonSpec

func SafeForLoggingBuildCommonSpec(spec *buildapi.CommonSpec) *buildapi.CommonSpec

SafeForLoggingBuildCommonSpec returns a copy of a CommonSpec with proxy credential env variable values redacted.

func SafeForLoggingEnvVar

func SafeForLoggingEnvVar(env []kapi.EnvVar) []kapi.EnvVar

SafeForLoggingEnvVar returns a copy of an EnvVar array with proxy credential values redacted.

func SafeForLoggingEnvironmentList

func SafeForLoggingEnvironmentList(env s2iapi.EnvironmentList) s2iapi.EnvironmentList

SafeForLoggingEnvironmentList returns a copy of an s2i EnvironmentList array with proxy credential values redacted.

func SafeForLoggingS2IConfig

func SafeForLoggingS2IConfig(config *s2iapi.Config) *s2iapi.Config

SafeForLoggingS2IConfig returns a copy of an s2i Config with proxy credentials redacted.

func SafeForLoggingURL

func SafeForLoggingURL(u *url.URL) *url.URL

SafeForLoggingURL removes the user:password section of a url if present. If not present the value is returned unchanged.

func SetBuildConfigEnv

func SetBuildConfigEnv(buildConfig *buildapi.BuildConfig, env []kapi.EnvVar)

SetBuildConfigEnv replaces the current buildconfig environment

func SetBuildEnv

func SetBuildEnv(build *buildapi.Build, env []kapi.EnvVar)

SetBuildEnv replaces the current build environment

func UpdateBuildEnv

func UpdateBuildEnv(build *buildapi.Build, env []kapi.EnvVar)

UpdateBuildEnv updates the strategy environment This will replace the existing variable definitions with provided env

func VersionForBuild added in v1.1.2

func VersionForBuild(build *buildapi.Build) int

VersionForBuild returns the version from the provided build name. If no version can be found, 0 is returned to indicate no version.

Types

This section is empty.

Directories

Path Synopsis
Package dockerfile has utilities that complement Docker's official Dockerfile parser.
Package dockerfile has utilities that complement Docker's official Dockerfile parser.

Jump to

Keyboard shortcuts

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