// mergeBuildTriggers returns an array of BuildTriggerPolicies that have no duplicates, in the same order
// as they exist in their original arrays (a zip-merge).
519355
func mergeBuildTriggers(dst, src []buildv1.BuildTriggerPolicy) []buildv1.BuildTriggerPolicy {
	var result []buildv1.BuildTriggerPolicy
	for _, current := range dst {
		if findBuildTrigger(src, current) != -1 {
			result = append(result, current)
		}
	}
	for _, current := range src {
		if findBuildTrigger(result, current) == -1 {
			result = append(result, current)
		}
	}
	return result
}
466699
func (r *SourceRepository) AddBuildConfigMaps(configMaps []string) error {
	injections := s2iapi.VolumeList{}
	r.configMaps = []buildv1.ConfigMapBuildSource{}
	for _, in := range configMaps {
		if err := injections.Set(in); err != nil {
			return err
		}
	}
	configMapExists := func(name string) bool {
		for _, c := range r.configMaps {
			if c.ConfigMap.Name == name {
				return true
			}
		}
		return false
	}
	for _, in := range injections {
		if r.GetStrategy() == newapp.StrategyDocker && filepath.IsAbs(in.Destination) {
			return fmt.Errorf("for the docker strategy, the configMap destination directory %q must be a relative path", in.Destination)
		}
		if len(validation.ValidateConfigMapName(in.Source, false)) != 0 {
			return fmt.Errorf("the %q must be a valid configMap name", in.Source)
		}
		if configMapExists(in.Source) {
			return fmt.Errorf("the %q configMap can be used just once", in.Source)
		}
		r.configMaps = append(r.configMaps, buildv1.ConfigMapBuildSource{
			ConfigMap:      corev1.LocalObjectReference{Name: in.Source},
			DestinationDir: in.Destination,
		})
	}
	return nil
}
95338
func AddBuildEdges(g osgraph.MutableUniqueGraph, node *buildgraph.BuildConfigNode) {
	for _, n := range g.(graph.Graph).Nodes() {
		if buildNode, ok := n.(*buildgraph.BuildNode); ok {
			if buildNode.Build.Namespace != node.BuildConfig.Namespace {
				continue
			}
			if belongsToBuildConfig(node.BuildConfig, buildNode.Build) {
				g.AddEdge(node, buildNode, BuildEdgeKind)
			}
		}
	}
}
466811
func NewBuildArgs(argsFromOptions map[string]*string) *BuildArgs {
	return &BuildArgs{
		allowedBuildArgs: make(map[string]*string),
		allowedMetaArgs:  make(map[string]*string),
		referencedArgs:   make(map[string]struct{}),
		argsFromOptions:  argsFromOptions,
	}
}
35956
func NewBuildlogger(name string, conf *BuildloggerConfig, l LevelInfo) (Sender, error) {
	s, err := MakeBuildlogger(name, conf)
	if err != nil {
		return nil, err
	}

	return setup(s, name, l)
}
496779
func (e *engineImpl) EmitTriggers(c context.Context, perJob map[*Job][]*internal.Trigger) error {
	// Make sure the caller has permissions to add triggers to all jobs.
	jobs := make([]*Job, 0, len(perJob))
	for j := range perJob {
		jobs = append(jobs, j)
	}
	switch filtered, err := e.filterForRole(c, jobs, acl.Triggerer); {
	case err != nil:
		return errors.Annotate(err, "transient error when checking Triggerer role").Err()
	case len(filtered) != len(jobs):
		return ErrNoPermission // some jobs are not triggerable
	}

	// Actually trigger.
	return parallel.FanOutIn(func(tasks chan<- func() error) {
		for job, triggers := range perJob {
			jobID := job.JobID
			triggers := triggers
			tasks <- func() error {
				return e.execEnqueueTriggersTask(c, &internal.EnqueueTriggersTask{
					JobId:    jobID,
					Triggers: triggers,
				})
			}
		}
	})
}
1144298
func (e *SyncedEnforcer) BuildRoleLinks() {
	e.m.RLock()
	defer e.m.RUnlock()
	e.Enforcer.BuildRoleLinks()
}
16039
func Convert_v1_BuildTriggerCause_To_build_BuildTriggerCause(in *v1.BuildTriggerCause, out *build.BuildTriggerCause, s conversion.Scope) error {
	return autoConvert_v1_BuildTriggerCause_To_build_BuildTriggerCause(in, out, s)
}
61420
func filterBuildImageTriggers(src []buildv1.BuildTriggerPolicy, trigger ImageChangeTrigger, strategyTrigger *ImageChangeTrigger) []buildv1.BuildTriggerPolicy {
	var dst []buildv1.BuildTriggerPolicy
	for i := range src {
		if triggerMatchesBuildImageChange(trigger, strategyTrigger, src[i].ImageChange) {
			continue
		}
		dst = append(dst, src[i])
	}
	return dst
}
713998
func Convert_v1_WebHookTrigger_To_build_WebHookTrigger(in *v1.WebHookTrigger, out *build.WebHookTrigger, s conversion.Scope) error {
	return autoConvert_v1_WebHookTrigger_To_build_WebHookTrigger(in, out, s)
}
1277163
func Merge(w io.Writer, opts *BuilderOpts, itrs []Iterator, f MergeFunc) error {
	builder, err := New(w, opts)
	if err != nil {
		return err
	}

	itr, err := NewMergeIterator(itrs, f)
	for err == nil {
		k, v := itr.Current()
		err = builder.Insert(k, v)
		if err != nil {
			return err
		}
		err = itr.Next()
	}

	if err != nil && err != ErrIteratorDone {
		return err
	}

	err = itr.Close()
	if err != nil {
		return err
	}

	err = builder.Close()
	if err != nil {
		return err
	}

	return nil
}
239354
func newBuildListener(streamNamePrefix string, onErr func(error)) *buildListener {
	if onErr == nil {
		panic("onErr is nil")
	}

	streamNamePrefix = strings.TrimSuffix(streamNamePrefix, "/") + "/"
	return &buildListener{
		streamNamePrefix: streamNamePrefix,
		buildStreamName:  streamNamePrefix + BuildStreamName,
		onErr:            onErr,
	}
}
524662
func AddAllBuildEdges(g osgraph.MutableUniqueGraph) {
	for _, node := range g.(graph.Graph).Nodes() {
		if bcNode, ok := node.(*buildgraph.BuildConfigNode); ok {
			AddBuildEdges(g, bcNode)
		}
	}
}
630852
func (b *Builder) AddBuildTags(tags ...string) {
	b.context.BuildTags = append(b.context.BuildTags, tags...)
}
131763
func hasUpdatedTriggers(current, previous appsapi.DeploymentConfig) bool {
	for _, ct := range current.Spec.Triggers {
		found := false
		if ct.Type != appsapi.DeploymentTriggerOnImageChange {
			continue
		}
		for _, pt := range previous.Spec.Triggers {
			if pt.Type != appsapi.DeploymentTriggerOnImageChange {
				continue
			}
			if found = ct.ImageChangeParams.From.Namespace == pt.ImageChangeParams.From.Namespace &&
				ct.ImageChangeParams.From.Name == pt.ImageChangeParams.From.Name; found {
				break
			}
		}
		if !found {
			klog.V(4).Infof("Deployment config %s/%s current version contains new trigger %#v", current.Namespace, current.Name, ct)
			return true
		}
	}
	return false
}
64586
func Convert_v1_ConfigMapBuildSource_To_build_ConfigMapBuildSource(in *v1.ConfigMapBuildSource, out *build.ConfigMapBuildSource, s conversion.Scope) error {
	return autoConvert_v1_ConfigMapBuildSource_To_build_ConfigMapBuildSource(in, out, s)
}
1174133
func BuildByBuildConfigIndexFunc(obj interface{}) ([]string, error) {
	build, ok := obj.(*buildv1.Build)
	if !ok {
		return nil, fmt.Errorf("not a build: %v", build)
	}
	config := build.Status.Config
	if config == nil {
		return []string{"orphan"}, nil
	}
	return []string{config.Namespace + "/" + config.Name}, nil
}