Merge pull request #1641 from ndeloof/profiles

fix detecting active profiles implied by selected services
This commit is contained in:
Nicolas De loof 2021-05-05 10:23:27 +02:00 committed by GitHub
commit 04c78c24e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -120,11 +120,13 @@ func (o *projectOptions) toProject(services []string, po ...cli.ProjectOptionsFn
return nil, metrics.WrapComposeError(err)
}
s, err := project.GetServices(services...)
if err != nil {
return nil, err
if len(services) > 0 {
s, err := project.GetServices(services...)
if err != nil {
return nil, err
}
o.Profiles = append(o.Profiles, s.GetProfiles()...)
}
o.Profiles = append(o.Profiles, s.GetProfiles()...)
if profiles, ok := options.Environment["COMPOSE_PROFILES"]; ok {
o.Profiles = append(o.Profiles, strings.Split(profiles, ",")...)