Ejemplo n.º 1
0
func deleteBuilds(client osclient.Interface, ns string) error {
	items, err := client.Builds(ns).List(labels.Everything(), fields.Everything())
	if err != nil {
		return err
	}
	for i := range items.Items {
		err := client.Builds(ns).Delete(items.Items[i].Name)
		if err != nil && !errors.IsNotFound(err) {
			return err
		}
	}
	return nil
}
Ejemplo n.º 2
0
func unloadBuildLabel(client osclient.Interface, application *api.Application, labelSelector labels.Selector) error {
	resourceList, _ := client.Builds(application.Namespace).List(kapi.ListOptions{LabelSelector: labelSelector, FieldSelector: fields.Everything()})
	errs := []error{}
	for _, resource := range resourceList.Items {
		if !hasItem(application.Spec.Items, api.Item{Kind: "Build", Name: resource.Name}) {
			delete(resource.Labels, fmt.Sprintf("%s.application.%s", application.Namespace, application.Name))
			if _, err := client.Builds(application.Namespace).Update(&resource); err != nil {
				errs = append(errs, err)
			}
		}
	}

	return nil
}
Ejemplo n.º 3
0
func deleteBuilds(client osclient.Interface, ns string) error {
	items, err := client.Builds(ns).List(kapi.ListOptions{})
	if err != nil {
		if errors.IsNotFound(err) {
			return nil
		}
		return err
	}
	for i := range items.Items {
		err := client.Builds(ns).Delete(items.Items[i].Name)
		if err != nil && !errors.IsNotFound(err) {
			return err
		}
	}
	return nil
}
Ejemplo n.º 4
0
func loadBuilds(g osgraph.Graph, graphLock sync.Mutex, namespace string, kclient kclient.Interface, client client.Interface) error {
	builds, err := client.Builds(namespace).List(labels.Everything(), fields.Everything())
	if err != nil {
		return err
	}

	graphLock.Lock()
	defer graphLock.Unlock()
	for i := range builds.Items {
		buildgraph.EnsureBuildNode(g, &builds.Items[i])
	}

	return nil
}