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

docs: fix incorrect information about arg scoping #5381

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

dvdksn
Copy link
Collaborator

@dvdksn dvdksn commented Oct 2, 2024

ARGs are inherited by downstream build stages, if declared in a base
stage. The documentation ambiguously stated that ARGs are out of scope
in other stages, where it really meant other stages that are not
child/downstream stages.

Signed-off-by: David Karlsson 35727626+dvdksn@users.noreply.github.com

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.

I believe this inheriting behavior is specific to BuildKit (but users should not care anymore so don't think worth mentioning).

An `ARG` instruction goes out of scope at the end of the build
stage where it was defined. To use an argument in multiple stages, each stage must
include the `ARG` instruction.
An `ARG` variable declared inside a build stage is automatically inherited by
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure is "downstream build stage" is something that is easily understandable to everyone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good callout, I think that term must have bled over from when I was updating the ONBUILD section where we talk about downstream builds. Let me rephrase.

ARGs are inherited by downstream build stages, if declared in a base
stage. The documentation ambiguously stated that ARGs are out of scope
in other stages, where it really meant other stages that are not
child/downstream stages.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn force-pushed the clarify-arg-scope branch from 8ebebb3 to fba1b10 Compare October 3, 2024 09:02
@dvdksn dvdksn requested a review from tonistiigi October 3, 2024 09:02
@tonistiigi tonistiigi merged commit fdf5d37 into moby:master Oct 3, 2024
31 checks passed
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.

2 participants