Skip to content

exporter: add session export finalization - #6978

Merged
crazy-max merged 1 commit into
moby:masterfrom
fiam:alberto/session-export-finalization
Jul 23, 2026
Merged

exporter: add session export finalization#6978
crazy-max merged 1 commit into
moby:masterfrom
fiam:alberto/session-export-finalization

Conversation

@fiam

@fiam fiam commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an optional FinalizeExport RPC for session exporter providers
  • pass the combined exporter response to the callback after exports complete
  • allow finalize-only providers with no exporter-discovery callback
  • preserve compatibility by ignoring Unimplemented and Unavailable
    responses while propagating other callback errors

This gives session providers a completion hook while build gateway
references are still available.

Testing

  • make generated-files
  • go test ./session/exporter/...
  • go test ./solver/llbsolver
  • go test ./client -run '^$'

@fiam
fiam force-pushed the alberto/session-export-finalization branch 4 times, most recently from 41c8633 to ddb31ed Compare July 22, 2026 23:45
@fiam
fiam marked this pull request as ready for review July 22, 2026 23:50
@fiam
fiam force-pushed the alberto/session-export-finalization branch from ddb31ed to 1684055 Compare July 22, 2026 23:51
Comment thread solver/llbsolver/export.go Outdated
}

func (s *Solver) finalizeSessionExport(ctx context.Context, sessionID string, exporterResponse map[string]string) error {
caller, err := s.sm.Get(ctx, sessionID, false)

@crazy-max crazy-max Jul 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have the same shape as getSessionExporters for s.sm.Get:

timeoutCtx, cancel := context.WithCancelCause(ctx)
timeoutCtx, _ = context.WithTimeoutCause(timeoutCtx, 5*time.Second, errors.WithStack(context.DeadlineExceeded)) //nolint:govet
defer func() { cancel(errors.WithStack(context.Canceled)) }()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification! I've added the same timeout for s.sm.Get in both places, PTAL

Add a FinalizeExport RPC to pass the combined exporter response back to
the session provider after all exports complete. This lets clients run
completion work while the build's gateway references remain available.

Keep the callback optional for compatibility with existing session
exporters. Ignore unsupported finalization, propagate callback failures,
and support providers that only register a finalization callback.

Signed-off-by: Alberto Garcia Hierro <alberto.hierro@docker.com>
@fiam
fiam force-pushed the alberto/session-export-finalization branch from 1684055 to 30a3c27 Compare July 23, 2026 15:46
@crazy-max
crazy-max merged commit 7559380 into moby:master Jul 23, 2026
214 of 215 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants