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

compose go v1.13.4 #1753

Merged
merged 1 commit into from
May 10, 2023
Merged

compose go v1.13.4 #1753

merged 1 commit into from
May 10, 2023

Conversation

nicksieger
Copy link
Member

@nicksieger nicksieger commented Apr 21, 2023

No description provided.

Signed-off-by: Nick Sieger <nick@nicksieger.com>
cfg, err := loader.Load(compose.ConfigDetails{
ConfigFiles: cfgs,
Environment: envs,
}, func(options *loader.Options) {
options.SetProjectName("bake", false)
Copy link
Member

Choose a reason for hiding this comment

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

There is no defaults anymore for the project name? I was thinking it was the name of the working directory?

Copy link
Member Author

Choose a reason for hiding this comment

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

compose-go was raising a "project name must not be empty" error without this. Looks like the logic changed in compose-spec/compose-go#374. Might have been inadvertent, I'll check with Milas on that.

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a mix of "low" and "high" level loader stuff in compose-go for programmatic vs CLI usage but the separation is not clean 😔

I think we should rename and export this as something like WithDefaultProjectNameStrategy: https://github.com/compose-spec/compose-go/blob/ef6c1671ed3f3844b58f61c9f4c8e5e9cd94b5f4/cli/options.go#L447-L460

Right now that's what the ProjectFromOptions method is using, but it's not accessible if you're using loader.Load directly

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, good to know. There's nothing that I'm aware of in buildx that's dependent on the latest compose-go, so does it work to file an issue and/or start a PR over there and close this in favor of a new compose-go upgrade PR later on?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, is there any possible workaround we could do for this temporarily? I'd like to take the latest compose version in buildx v0.11 (aimed for this week or soon after), but also would be nice to make sure we take a tagged version from compose-go.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@crazy-max @milas @nicksieger: is taking this change as-is with "bake" as the project name acceptable for the time being? If so, we can merge this and move on with the v0.11 milestone.

Copy link
Member Author

Choose a reason for hiding this comment

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

I proposed the workaround by writing the code, so it's an implicit 👍 from me. I don't think the project name is ever really exposed when baking a compose file, right?

@jedevc jedevc added this to the v0.11.0 milestone Apr 25, 2023
Copy link
Collaborator

@jedevc jedevc left a comment

Choose a reason for hiding this comment

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

@milas @nicksieger it would be nice to take this for v0.11 of buildx if we could, any objections?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we also want to add support for the new compose features at the same time?

They should slot neatly into compose.go, with tests in compose_test.go:

buildx/bake/compose.go

Lines 86 to 103 in 43a07f3

t := &Target{
Name: targetName,
Context: contextPathP,
Dockerfile: dockerfilePathP,
Tags: s.Build.Tags,
Labels: labels,
Args: flatten(s.Build.Args.Resolve(func(val string) (string, bool) {
if val, ok := s.Environment[val]; ok && val != nil {
return *val, true
}
val, ok := cfg.Environment[val]
return val, ok
})),
CacheFrom: s.Build.CacheFrom,
CacheTo: s.Build.CacheTo,
NetworkMode: &s.Build.Network,
Secrets: secrets,
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, maybe they could go in a separate PR after we decide how to handle the project name default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure I'd be happy with that.

cfg, err := loader.Load(compose.ConfigDetails{
ConfigFiles: cfgs,
Environment: envs,
}, func(options *loader.Options) {
options.SetProjectName("bake", false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, is there any possible workaround we could do for this temporarily? I'd like to take the latest compose version in buildx v0.11 (aimed for this week or soon after), but also would be nice to make sure we take a tagged version from compose-go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants