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

build: variables (arg, env) #19386

Merged
merged 4 commits into from
Feb 20, 2024
Merged

build: variables (arg, env) #19386

merged 4 commits into from
Feb 20, 2024

Conversation

dvdksn
Copy link
Collaborator

@dvdksn dvdksn commented Feb 13, 2024

Proposed changes

Adds a new manuals page about build variables (arg, env) highlighting their differences and use.

https://deploy-preview-19386--docsdocker.netlify.app/build/building/variables/

  • config: add example node version
  • config: fix incorrect example version for alpine
  • build: add "build variables" page

Related issues (optional)

@netlify /build/building/variables/

@github-actions github-actions bot added area/build Relates to Dockerfiles or docker build command hugo Updates related to hugo labels Feb 13, 2024
Copy link

netlify bot commented Feb 13, 2024

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit b5032e1
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/65d46a1f48f1150008d705c8
😎 Deploy Preview https://deploy-preview-19386--docsdocker.netlify.app/build/building/variables
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dvdksn dvdksn marked this pull request as ready for review February 13, 2024 09:47
@dvdksn dvdksn requested a review from crazy-max as a code owner February 13, 2024 09:47
@dvdksn dvdksn force-pushed the build-variables branch 2 times, most recently from 383e5e4 to 60eb76e Compare February 13, 2024 09:52
content/build/building/env-vars.md Show resolved Hide resolved
content/build/building/variables.md Outdated Show resolved Hide resolved
content/build/building/variables.md Show resolved Hide resolved
content/build/building/variables.md Outdated Show resolved Hide resolved
content/build/building/variables.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Oh! Wanted to reply on slack but didn't get to that. I wonder if we could come up with a slightly modified example where the "breakpoint" stages are consecutive in the Dockerfile, i.e. (trying to give it my best ASCII-art here);

FROM alpine:${VERSION} AS stage-1
ARG HELLO=hello
RUN echo $HELLO

..................................

# stage-1-a is a continuation of stage-1, and therefore inherits build-args
# that are defined in it. This stage can be used as a "break-point" within
# the stage-1 stage.
FROM stage-1 AS stage-1-a
ARG WORLD=world
RUN echo $HELLO $WORLD

..................................

# similarly, stage-1-b is a continuation of stage-1-a, and can act as
# another break-point in stage-1 for debugging purposes.
FROM stage-1-a AS stage-1-b
RUN echo $HELLO $WORLD

In the above, we could put all of the stage-1-xxx in a single "box", but with a dotted separator between them perhaps.

content/build/building/variables.md Show resolved Hide resolved
@dvdksn
Copy link
Collaborator Author

dvdksn commented Feb 15, 2024

any blocking issues with this one @thaJeztah or @crazy-max. The illustration could maybe be prettier but I think it gets the message across.

@dvdksn dvdksn requested a review from a team February 15, 2024 12:07
content/build/building/variables.md Outdated Show resolved Hide resolved
content/build/building/variables.md Outdated Show resolved Hide resolved

### BUILDKIT_HOST

_Introduced in [Buildx v0.9.0](../release-notes.md#090)_
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment: I've started using a note to do the same thing with Compose.
> Available in ....etc
Perhaps we should agree on a format going forward for the sake of consistency? Which is better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes we definitely should standardize this. I think we should probably have a shortcode for it like k8s does with feature_state. That would also let us have more control over rendering, and better structure the parameters (possibly even let us specify and test for old versions to be cleaned up after a while). Maybe for a follow-up?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 sounds good to me

Copy link
Member

Choose a reason for hiding this comment

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

"+1" on having this kind of information in a more structured form.

I recall we discussed this at some point, and know we have the "API version" annotations for some options, e.g.;

Screenshot 2024-02-20 at 11 06 40

For those we (used to? still have?) a configurable "threshold", which allows use to conditionally render those badges. That way, we can keep the metadata (added in version X), but can decide whether it's still relevant to highlight/show (e.g., highlighting a feature that was added 6 or 7 years ago is no longer very informative).

If we have specific criteria, we could also use that information to automatically render "new" / "what's new" badges, such as what's being added in #19444 (add a "new" badge because it was added for Docker Desktop 4.28, but once we are a couple of version(s) along, we can hide that).

@dvdksn dvdksn merged commit 3d7c837 into docker:main Feb 20, 2024
9 checks passed
@dvdksn dvdksn deleted the build-variables branch February 20, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Relates to Dockerfiles or docker build command hugo Updates related to hugo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants