mirror of
https://github.com/docker/compose.git
synced 2025-07-23 05:34:36 +02:00
Emit events for building images
Signed-off-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
799ab842a0
commit
a9de9abcfb
@ -158,11 +158,16 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
|
|||||||
}
|
}
|
||||||
service := serviceToBuild.service
|
service := serviceToBuild.service
|
||||||
|
|
||||||
|
cw := progress.ContextWriter(ctx)
|
||||||
|
serviceName := fmt.Sprintf("Service %s", name)
|
||||||
|
|
||||||
if !buildkitEnabled {
|
if !buildkitEnabled {
|
||||||
|
cw.Event(progress.BuildingEvent(serviceName))
|
||||||
id, err := s.doBuildClassic(ctx, project, service, options)
|
id, err := s.doBuildClassic(ctx, project, service, options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
cw.Event(progress.BuiltEvent(serviceName))
|
||||||
builtDigests[getServiceIndex(name)] = id
|
builtDigests[getServiceIndex(name)] = id
|
||||||
|
|
||||||
if options.Push {
|
if options.Push {
|
||||||
@ -180,10 +185,12 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw.Event(progress.BuildingEvent(serviceName))
|
||||||
digest, err := s.doBuildBuildkit(ctx, name, buildOptions, w, nodes)
|
digest, err := s.doBuildBuildkit(ctx, name, buildOptions, w, nodes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
cw.Event(progress.BuiltEvent(serviceName))
|
||||||
builtDigests[getServiceIndex(name)] = digest
|
builtDigests[getServiceIndex(name)] = digest
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -70,11 +70,6 @@ func (s composeService) dryRunBuildResponse(ctx context.Context, name string, op
|
|||||||
w := progress.ContextWriter(ctx)
|
w := progress.ContextWriter(ctx)
|
||||||
buildResponse := map[string]*client.SolveResponse{}
|
buildResponse := map[string]*client.SolveResponse{}
|
||||||
dryRunUUID := fmt.Sprintf("dryRun-%x", sha1.Sum([]byte(name)))
|
dryRunUUID := fmt.Sprintf("dryRun-%x", sha1.Sum([]byte(name)))
|
||||||
w.Event(progress.Event{
|
|
||||||
ID: " ",
|
|
||||||
Status: progress.Done,
|
|
||||||
Text: fmt.Sprintf("build service %s", name),
|
|
||||||
})
|
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: "==>",
|
ID: "==>",
|
||||||
Status: progress.Done,
|
Status: progress.Done,
|
||||||
|
@ -153,6 +153,16 @@ func RemovedEvent(id string) Event {
|
|||||||
return NewEvent(id, Done, "Removed")
|
return NewEvent(id, Done, "Removed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BuildingEvent creates a new Building in progress Event
|
||||||
|
func BuildingEvent(id string) Event {
|
||||||
|
return NewEvent(id, Working, "Building")
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuiltEvent creates a new built (done) Event
|
||||||
|
func BuiltEvent(id string) Event {
|
||||||
|
return NewEvent(id, Done, "Built")
|
||||||
|
}
|
||||||
|
|
||||||
// SkippedEvent creates a new Skipped Event
|
// SkippedEvent creates a new Skipped Event
|
||||||
func SkippedEvent(id string, reason string) Event {
|
func SkippedEvent(id string, reason string) Event {
|
||||||
return Event{
|
return Event{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user