Skip to content

Commit

Permalink
Fix #1305: fix case of transitive equality between images
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro authored and astefanutti committed Feb 28, 2020
1 parent 23f1263 commit 15f6d0e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/builder/spectrum/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,28 @@ package spectrum

import (
"fmt"
"os"
"path"

"github.com/apache/camel-k/pkg/builder"
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/log"
spectrum "github.com/container-tools/spectrum/pkg/builder"
)

func publisher(ctx *builder.Context) error {
libraryPath := path.Join(ctx.Path, "context", "dependencies")
_, err := os.Stat(libraryPath)
if err != nil && os.IsNotExist(err) {
// this can only indicate that there are no more libraries to add to the base image,
// because transitive resolution is the same even if spec differs
log.Infof("No new image to build, reusing existing image %s", ctx.BaseImage)
ctx.Image = ctx.BaseImage
return nil
} else if err != nil {
return err
}

pl, err := platform.GetCurrentPlatform(ctx.C, ctx, ctx.Namespace)
if err != nil {
return err
Expand Down Expand Up @@ -57,7 +71,7 @@ func publisher(ctx *builder.Context) error {
PushInsecure: pl.Status.Build.Registry.Insecure,
}

digest, err := spectrum.Build(options, path.Join(ctx.Path, "context", "dependencies")+":/deployments/dependencies")
digest, err := spectrum.Build(options, libraryPath+":/deployments/dependencies")
if err != nil {
return err
}
Expand Down

0 comments on commit 15f6d0e

Please sign in to comment.