This is an automated email from the ASF dual-hosted git repository. nferraro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 1b361c01ae14485668e58ef12fc674f4e91daef7 Author: nferraro <ni.ferr...@gmail.com> AuthorDate: Fri Sep 21 13:40:16 2018 +0200 bind incremental builder to standard flow --- pkg/stub/action/context/build.go | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/pkg/stub/action/context/build.go b/pkg/stub/action/context/build.go index a815c7c..7b872f4 100644 --- a/pkg/stub/action/context/build.go +++ b/pkg/stub/action/context/build.go @@ -34,7 +34,7 @@ import ( // NewIntegrationContextBuildAction creates a new build handling action for the context func NewIntegrationContextBuildAction(ctx context.Context, namespace string) IntegrationContextAction { assembler := assemble.NewMavenAssembler(ctx) - publisher := publish.NewS2IPublisher(ctx, namespace) + publisher := publish.NewS2IIncrementalPublisher(ctx, namespace, newContextLister(namespace)) manager := build.NewManager(ctx, assembler, publisher) return &integrationContextBuildAction{ @@ -115,3 +115,38 @@ func (action *integrationContextBuildAction) informIntegrations(context *v1alpha } return nil } + +// ================================================================= + +type contextLister struct { + namespace string +} + +func newContextLister(namespace string) contextLister { + return contextLister{ + namespace: namespace, + } +} + +func (l contextLister) ListPublishedImages() ([]publish.PublishedImage, error) { + list := v1alpha1.NewIntegrationContextList() + err := sdk.List(l.namespace, &list, sdk.WithListOptions(&metav1.ListOptions{})) + if err != nil { + return nil, err + } + images := make([]publish.PublishedImage, 0) + for _, ctx := range list.Items { + if ctx.Labels == nil { + continue + } + if ctxType, present := ctx.Labels["camel.apache.org/context.type"]; !present || ctxType != "platform" { + continue + } + + images = append(images, publish.PublishedImage{ + Image: ctx.Status.Image, + Classpath: ctx.Status.Classpath, + }) + } + return images, nil +}