-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Proposal RFC: Java Agents and More Layers #455
Conversation
addFile 'another/file', '/another/path/on/image' | ||
``` | ||
|
||
All of the files would be added to a single new layer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to specify this implementation detail? It might make sense to place larger file trees in separate layers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placing in separate layers may be a lot more complicated, since we would need some sort of decider that would deterministically place the files into a certain number of layers. I can remove this as a detail though since it is implementation-level.
|
||
The configuration for adding additional files (including Java agents) would look something like: | ||
|
||
*(The exact configuration is to be decided before this PR is merged. Alternative naming for this parameter include: `additionalFiles`, `extraFiles`, and `copyFiles`.)* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading these examples, the singular addFile
implies that each item is for a single file, and that I'd need to list out each file to copy to a directory. I thought we would allow specifying a directory to have the directory tree to be copied?
In which case we also need to specify the semantics for directories. Perhaps should adopt the rsync source-path semantics?
If the
from
location is a directory and has a trailing slash then the contents of that directory are copied. Otherwise the contents are copied into a new directory named for the last component of thefrom
location. All intermediate directories are created as required. The destination specifies a directory in the image. The copy fails if the destination is a file.
For example, given source filesconfig/ssh/ssh_config
andconfig/ssh/sshd_config
and wish to copy them into/etc/ssh
so that the image contains/etc/ssh/ssh_config
and/etc/ssh/sshd_config
then we can do either of the following:
<from>config/ssh</from><to>/etc</to>
<from>config/ssh/</from><to>/etc/ssh</to>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that sounds like a good way to do it! I'll update this with these semantics for directories. In terms of naming for addFile
I was thinking of File
as referring to both a directory and a regular file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was just thinking and maybe we should have it be the semantics of Dockerfile COPY
, where essentially:
- if
from
is a directory, only the contents are copied, and not the directory itself - if
to
ends with a trailing slash, it is considered a directory. Otherwise, it is considered a regular file. - if
from
refers to multiple files (like the contents of a directory),to
must end with a trailing slash, and thefrom
files will be added to that directory.
We won't support glob matching though, at least not until someone says they need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Docker's COPY semantics makes sense.
<from>another/file</from> | ||
<to>/another/path/on/image</to> | ||
</addFile> | ||
</addFiles> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried playing with some examples, and this felt a bit more concise?
<files>
<copy from="path/to/file" to="/path/in/image"/>
<copy from="path/to/file" to="/path/in/image"/>
</files>
and with groovy
copyIn 'path/to/file', '/path/on/image'
Using copy avoids any confusion with Dockerfile
's ADD
and its unpacking? One downside to both is that Docker creates a separate layer for each COPY
and ADD
, which we don't do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Maven configuration can support duplicate tags or tag parameters? @loosebazooka ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh jeepers 🤦♂️ There does seem to be a way to support relatively arbitrary XML but it's not pretty and I don't think it's warranted by this situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that might be a little un-maven-y
|
||
### Alternative (Rejected) Proposal | ||
|
||
The alternative proposal was rejected because we deemed that layering should be an implementation detail that should not be exposed to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this out with **The alternative proposal was rejected …**
?
@@ -58,7 +58,7 @@ addFile 'path/to/file', '/path/on/image' | |||
addFile 'another/file', '/another/path/on/image' | |||
``` | |||
|
|||
All of the files would be added to a single new layer. | |||
*Directories will be handled using [rsync](https://linux.die.net/man/1/rsync) source-path semantics, where, for example, `addFile 'path/to/directory', '/path/on/image'` would put all the files in `path/to/directory` into the directory `/path/on/image/directory`, but `addFile 'path/to/directory', '/path/on/image'` (trailing slash) would put all the files into the directory `/path/on/image`.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second example is missing the trailing slash!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, will add that.
I just tested
but I'm not sure if this actually reads well. |
This proposal will probably be retired in favor of the incubating |
Are there any plans for this proposal, or should we just close this PR? |
I think this will be good to have as a record in the proposals (and as a reference for the design behind the current solution). I'll touch this up with our current solution ( |
Changed the main proposal to regard |
|
||
The directory should also be able to be configured to override the `src/main/jib` default. | ||
|
||
### Alternative (Rejected) Proposal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have a ## Alternative Proposals
here as they otherwise fall under the ## Proposal
.
Update: This proposal will probably be retired in favor of the incubating
src/main/jib
convention. (#489)Request for comments. Approval upon merge.
Preview at https://github.com/GoogleContainerTools/jib/blob/more-layers-proposal/proposals/java_agents_and_more_layers.md
@linux-china
@saturnism
Fixes #378
Fixes #213 (closes in favor of this)
Regards #403