Skip to content

Commit 7513bc0

Browse files
committed
push image on the node where the image was built
1 parent 88de04e commit 7513bc0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cluster/calcium/build.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (c *Calcium) BuildImage(ctx context.Context, opts *types.BuildOptions) (ch
4141
case types.BuildFromRaw:
4242
resp, err = c.buildFromContent(ctx, node, refs, opts.Tar)
4343
case types.BuildFromExist:
44-
resp, err = c.buildFromExist(ctx, refs, opts.ExistID, opts.User)
44+
node, resp, err = c.buildFromExist(ctx, refs, opts.ExistID, opts.User)
4545
default:
4646
return nil, logger.Err(ctx, errors.WithStack(errors.New("unknown build type")))
4747
}
@@ -91,20 +91,20 @@ func (c *Calcium) buildFromContent(ctx context.Context, node *types.Node, refs [
9191
return resp, errors.WithStack(err)
9292
}
9393

94-
func (c *Calcium) buildFromExist(ctx context.Context, refs []string, existID, user string) (resp io.ReadCloser, err error) {
95-
node, err := c.getWorkloadNode(ctx, existID)
96-
if err != nil {
94+
func (c *Calcium) buildFromExist(ctx context.Context, refs []string, existID, user string) (node *types.Node, resp io.ReadCloser, err error) {
95+
if node, err = c.getWorkloadNode(ctx, existID); err != nil {
9796
return
9897
}
9998

10099
if _, err = node.Engine.ImageBuildFromExist(ctx, existID, refs, user); err != nil {
101-
return resp, errors.WithStack(err)
100+
return nil, nil, errors.WithStack(err)
102101
}
103-
return io.NopCloser(strings.NewReader("")), nil
102+
return node, io.NopCloser(strings.NewReader("")), nil
104103
}
105104

106105
func (c *Calcium) pushImageAndClean(ctx context.Context, resp io.ReadCloser, node *types.Node, tags []string) (chan *types.BuildImageMessage, error) { // nolint:unparam
107106
logger := log.WithField("Calcium", "pushImage").WithField("node", node).WithField("tags", tags)
107+
log.Infof(ctx, "[BuildImage] Pushing image at pod %s node %s", node.Podname, node.Name)
108108
return withImageBuiltChannel(func(ch chan *types.BuildImageMessage) {
109109
defer resp.Close()
110110
decoder := json.NewDecoder(resp)

0 commit comments

Comments
 (0)