GoogleContainerTools / jib-extensions

Apache License 2.0
117 stars 35 forks source link

`jib-ownership-extension` is not considering / chown-ing `extraDirectories` directories #163

Closed kristian closed 11 months ago

kristian commented 11 months ago

The jib-ownership-extension-gradle mentions in it's README.md:

Note the extension can only set ownership on files and directories that are put by Jib.

Seems this does not apply for directories / files added via the extraDirectories configuration.

It would be great if the extension / globs that you specify in the configuration.rules would also apply for files added in the extraDirectories.

chanseokoh commented 11 months ago

You may be hitting the known issue? You may not like the workaround, but you should be able to make it work. Take a look at https://stackoverflow.com/a/70977481/1701388.

Unable to change ownership of some parent directories.

When the Jib plugin assemables files into an image layer tarball, it automatically creates supplemental parent directory entries for each file. The extension cannot change the ownership of these directories. For a workaround, you can create empty directories under <project root>/src/main/jib/ (that is, utilizing the <extraDirectories> feature) to explicitly list the directories, after which the extension can see and change the ownership of such directories. For example, if you create an empty directory structure with <project root>/src/main/jib/app/classes/, you can change the ownership of /app and /app/classes. See this example.

kristian commented 11 months ago

Nice, thanks! 👍 Yes, we have been struggling with this today as it blocked a go-live, so we went back and forth debating the options, and because we did not find the known issues section you pointed out. But yes, by trial and error we ended up at exactly that solution, copying in the whole structure from a parent directory we built! 💯 Thanks!