Skip to content

Make env in ImageConfig a map - #1505

Merged
jlongtine merged 1 commit into
dagger:mainfrom
helderco:image-config
Jan 28, 2022
Merged

jlongtine merged 1 commit into
dagger:mainfrom
helderco:image-config

Conversation

@helderco

Copy link
Copy Markdown
Contributor

Closes #1437.

Fields in CUE were renamed to the lowercase version of Dockerfile instructions.

There's now opportunity to make other fields simpler to use (e.g., healthcheck).

This PR is focused on env.

Fields in CUE were renamed to the lowercase version of Dockerfile instructions.

There's now opportunity to make other fields simpler to use (e.g., healthcheck), this commit is focused on env.

Signed-off-by: Helder Correia <[email protected]>
@aluzzardi

Copy link
Copy Markdown
Contributor

Thanks @helderco -- this is great!

Just to state the obvious, the downside is we have to maintain our own copy of ImageConfig in a Go structure. If we miss upstream changes, we'll be "losing" data (e.g. #Pull + #Push will "strip" away any field we don't support).

I personally think this is an acceptable tradeoff -- the OCI spec is stable and not changing constantly.

/cc @shykes @jlongtine

label?: [string]: string
healthcheck?: #HealthCheck
shell?: [...string]
...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think ... is necessary any longer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kept it because I haven't added all fields to CUE (here). This is meant to serve as documentation for users.

For example, argsescaped is added with a true value if you use the shell form in a Dockerfile's CMD or ENTRYPOINT. The spec documents this: "True if command is already escaped (Windows specific)".

Although, since the fields were renamed, you'd have to look into the Go code to check on those that aren't included here, so there's an argument for adding all fields here as well. I can push an update for this.

@shykes shykes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM thanks @helderco for the great contribution!

I agree that the tradeoff is worth it. We can always add utility CUE definitions if someone wants to convert back and forth between the raw OCI schema and our developer-friendly format.

@jlongtine
jlongtine merged commit 7788b9f into dagger:main Jan 28, 2022
jlongtine referenced this pull request in jlongtine/dagger-old Jan 28, 2022
Signed-off-by: Joel Longtine <[email protected]>
@helderco
helderco deleted the image-config branch January 28, 2022 22:56
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.

PROPOSAL: Make Env in #ImageConfig a struct

4 participants