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

Parse service device count to int if possible #442

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

XiangRongLin
Copy link
Contributor

@XiangRongLin XiangRongLin commented Aug 4, 2023

When set via an environment variable an integer will be represented by a string, resulting in an error.
fixes: docker/compose#10667


The alternative would be to adjust the parsing of the yaml into the internal model, so it gets parsed as an int.
The env var is replaced in

newValue, err := opts.Substitute(value, template.Mapping(opts.LookupValue))

But it only allows setting strings and not int
Substitute func(string, template.Mapping) (string, error)

When set via an environment variable an integer will be represented by a string, resulting in an error.
fixes: docker/compose#10667

Signed-off-by: Xiang Rong Lin <[email protected]>
@XiangRongLin XiangRongLin marked this pull request as ready for review August 4, 2023 14:12
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

@ndeloof ndeloof merged commit 08d8d55 into compose-spec:master Aug 4, 2023
8 checks passed
@XiangRongLin XiangRongLin deleted the device-count-string-int branch August 5, 2023 07:08
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.

[BUG] Cannot use environment variable substitution when configuring the number of GPUs assigned to a service
3 participants