Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

history: fix empty Exporters attribute #5017

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented Jun 11, 2024

Since multiple exporters support #4134 in BuildKit 0.13, Record.Exporters is not set anymore.

This is related to the Type and Attrs fields not being set in the llbsolver.ExporterRequest: https://github.com/moby/buildkit/pull/4134/files#diff-0397d42d692ad676389ccf4b5a1126a3976ef69d4342b8423a6bbb51d21a9181L458-L459

But this is used when we want to set the Exporters for the build history:

if exp.Type != "" {

To fix this, I have updated the exporter.ExporterInstance interface to expose attributes and name of the exporter. Also removes Type and Attrs fields ExporterRequest that don't seem used anymore.

@jedevc
Copy link
Member

jedevc commented Jun 11, 2024

Ahhh nice catch! Looks like I got the results correctly added to the history record, but for some reason didn't think to get the right exporters attr.

Thanks! 🙏 🎉

@@ -187,6 +190,14 @@ func (e *imageExporterInstance) ID() int {
}

func (e *imageExporterInstance) Name() string {
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe Type() would be better?

Copy link
Member

@jedevc jedevc Jun 11, 2024

Choose a reason for hiding this comment

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

Potentially - note this also mirrors the structures of the cache exporter here.

Type and Name SGTM - then we keep the old field.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@@ -22,6 +22,8 @@ type ExporterInstance interface {
ID() int
Name() string
Config() *Config
Type() string
Attrs() map[string]string
Copy link
Member

Choose a reason for hiding this comment

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

(possible follow-up) Maybe the Attrs and Config() can be combined somehow in the future. Atm not obvious why there are two similar sounding things.

Copy link
Member

Choose a reason for hiding this comment

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

I think maybe a better approach is to change the solver.ExporterRequest to keep array of objects that keep type/attrs instead of raw ExporterInstance. Like it was previously with the keys that are now removed.

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Let's get this in as seems functionally correct. #5017 (comment) to be addressed in follow-up

@tonistiigi tonistiigi merged commit 4d9a4e5 into moby:master Jun 11, 2024
75 checks passed
@crazy-max crazy-max deleted the fix-history-exporters branch June 11, 2024 16:37
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