filter depends_on services when required is not set#432
Merged
glours merged 1 commit intocompose-spec:masterfrom Jul 18, 2023
Merged
filter depends_on services when required is not set#432glours merged 1 commit intocompose-spec:masterfrom
glours merged 1 commit intocompose-spec:masterfrom
Conversation
73afd7f to
39e2739
Compare
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
39e2739 to
27cae8c
Compare
laurazard
approved these changes
Jul 17, 2023
Member
laurazard
left a comment
There was a problem hiding this comment.
LGTM, just left a suggestion
| func (p *Project) GetServices(names ...string) (Services, error) { | ||
| services, servicesNotFound := p.getServicesByNames(names...) | ||
| if len(servicesNotFound) > 0 { | ||
| return services, fmt.Errorf("no such service: %s", servicesNotFound[0]) |
Member
There was a problem hiding this comment.
nit: we should return all not found services at once, otherwise if people have multiple services missing they'll have to go
$ compose up
[no such service: foo]
<fixes config>
$ compose up
[no such service: bar]
<yells at computer and fixes things again>
Collaborator
Author
There was a problem hiding this comment.
As this method is public, I didn't want to introduce a breaking change by adding the support depends_on.required attribute, so this implementation keep the same behaviour as the current one.
I agree we should return all the missing service at once, but I prefer to do that in a dedicated PR if this is fine for you @laurazard?
ndeloof
approved these changes
Jul 18, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a
depends_onis marked as non-required, we shouldn't return an error if not found