[ https://issues.apache.org/jira/browse/MASSEMBLY-918?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marat Abrarov updated MASSEMBLY-918: ------------------------------------ Description: This is new feature request similar to MASSEMBLY-668 and MASSEMBLY-442 (I cannot reopen existing JIRA issues - I have no required permissions in JIRA). Below is description of my case when I need Maven Assembly Plugin to provide ability to specify owner and group for files and directories (I need {{root:root}} actually). I need this ability (new feature) for TAR files created by Maven Assembly Plugin. I use Maven Assembly Plugin to prepare TAR, because # I use TARs with [{{ADD}} Dockerfile directive|https://docs.docker.com/engine/reference/builder/#add] because I have Linux and Windows build systems so TAR is the only option to add files into Docker image with specific Unix file permissions (thanks to {{fileMode}} and {{directoryMode}} options of Maven Assembly Plugin) # I have old Docker 1.13.1 (I'm limited to Red Hat Docker images and RHEL 7, I cannot use [Podman|https://podman.io/] because it lacks remote access which I need because of Windows is used on some development environments) and cannot use {{ADD --chown}} Dockerfile directive or multi-stage Dockerfile because of version of Docker # I cannot use {{RUN}} Dockerfile directive to change Unix file permissions and / or owner / group because it duplicates files added with {{ADD}} or {{COPY}} Dockerfile directives (the only simple way to add results of build into Docker image). Refer to [The backlash of chmod/chown/mv in your Dockerfile|https://medium.com/@lmakarov/the-backlash-of-chmod-chown-mv-in-your-dockerfile-f12fe08c0b55] for details. When I build on Windows - refer to [dockerfile-test|https://github.com/mabrarov/dockerfile-test] test project - then files are added with {{root:root}} owner (that's acceptable for my case). This can be tested with below commands (launche Docker container, so require Docker): {code:java} $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app/bin {code} It looks like this new feature requires changing of [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] which is used by Maven Assembly Plugin. I created PoC which works with some minor notes: # Changes in [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] can be found in [feature/MASSEMBLY-668|https://github.com/codehaus-plexus/plexus-archiver/compare/master...mabrarov:feature/MASSEMBLY-668] branch of [mabrarov/plexus-archiver|https://github.com/mabrarov/plexus-archiver] GitHub repository ## Tests for new code are missing ## JavaDoc and comments for new code are missing ## Only TAR implementation is extended and tested manually # Changes in Maven Assembly Plugin can be found in [feature/MASSEMBLY-668|https://github.com/apache/maven-assembly-plugin/compare/master...mabrarov:feature/MASSEMBLY-668] branch ## Tests for new code are missing ## Only TAR format, {{fileSets}} and {{dependencySets}} sections of Maven Assembly descriptor are tested manually ## Existing tests are broken because of mocking and verification which need to be adopted - build works only with {{-DskipTests}} ## JavaDoc and comments for new code are missing # Changes in test project utilizing this new feature can be found in [feature/root_owner_in_docker_image|https://github.com/mabrarov/dockerfile-test/compare/feature/root_owner_in_docker_image] branch of [mabrarov/dockerfile-test|https://github.com/mabrarov/dockerfile-test] GitHub repository ## I had to add each directory (where I need to specify owner and group) explicitly (even parent directories) because TAR format supports permissions, owner and group of directory only if TAR directory entries are added. This is true for permissions too ({{directoryMode}} option in Maven Assembly Plugin descriptor), so it's existing issue of Maven Assembly Plugin - when you need to store permissions for directories in TAR then you have to add directories explicitly to ensure that TAR directory entries are created - so I find this workaround acceptable, i.e I don't see a need to change smth in [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] or Maven Assembly Plugin to create TAR directory entries implicitly - one may not need these at all - i.e. if it's acceptable to create directories with default permissions then one may want to omit TAR directory entries and keep just TAR file entries and so optimize TAR. was: This is new feature request similar to MASSEMBLY-668 and MASSEMBLY-442 (I cannot reopen existing JIRA issues - I have no required permissions in JIRA). Below is description of my case when I need Maven Assembly Plugin to provide ability to specify owner and group for files and directories (I need {{root:root}} actually). I need this ability (new feature) for TAR files created by Maven Assembly Plugin. I use Maven Assembly Plugin to prepare TAR, because # I use TARs with [{{ADD}} Dockerfile directive|https://docs.docker.com/engine/reference/builder/#add] because I have Linux and Windows build systems so TAR is the only option to add files into Docker image with specific Unix file permissions (thanks to {{fileMode}} and {{directoryMode}} options of Maven Assembly Plugin) # I have old Docker 1.13.1 (I'm limited to Red Hat Docker images and RHEL 7, I cannot use [Podman|https://podman.io/] because it lacks remote access which I need because of Windows is used on some development environments) and cannot use {{ADD --chown}} Dockerfile directive or multi-stage Dockerfile because of version of Docker # I cannot use {{RUN}} Dockerfile directive to change Unix file permissions and / or owner / group because it duplicates files added with {{ADD}} or {{COPY}} Dockerfile directives (the only simple way to add results of build into Docker image). Refer to [The backlash of chmod/chown/mv in your Dockerfile|https://medium.com/@lmakarov/the-backlash-of-chmod-chown-mv-in-your-dockerfile-f12fe08c0b55] for details. When I build on Windows - refer to [dockerfile-test|https://github.com/mabrarov/dockerfile-test] test project - then files are added with {{root:root}} owner (that's acceptable for my case). This can be tested with below commands (launche Docker container, so require Docker): {code:java} $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app/bin {code} It looks like this new feature requires changing of [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] which is used by Maven Assembly Plugin. I created PoC which works with some minor notes: # Changes in [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] can be found in [feature/MASSEMBLY-668|https://github.com/codehaus-plexus/plexus-archiver/compare/master...mabrarov:feature/MASSEMBLY-668] branch of [mabrarov/plexus-archiver|https://github.com/mabrarov/plexus-archiver] GitHub repository ## Tests for new code are missing ## JavaDoc and comments for new code are missing ## Only TAR implementation is extended and tested manually # Changes in Maven Assembly Plugin can be found in [feature/MASSEMBLY-668|https://github.com/apache/maven-assembly-plugin/compare/master...mabrarov:feature/MASSEMBLY-668] branch ## Tests for new code are missing ## Only TAR format, {{fileSets}} and {{dependencySets}} sections of Maven Assembly descriptor are tested manually ## Existing tests are broken because of mocking and verification which need to be adopted - build works only with {{-DskipTests}} ## JavaDoc and comments for new code are missing # Changes in test project utilizing this new feature can be found in [feature/root_owner_in_docker_image|https://github.com/mabrarov/dockerfile-test/compare/feature/root_owner_in_docker_image] branch of [mabrarov/dockerfile-test|https://github.com/mabrarov/dockerfile-test] GitHub repository ## I had to add each directory (where I need to specify owner and group) explicitly (even parent directories) because TAR format supports this information only if TAR directory entries are added. This is true for permissions too ({{directoryMode}} option in Maven Assembly Plugin descriptor), so it's existing issue of Maven Assembly Plugin - when you need to store permissions for directories in TAR then you have to add directories explicitly to ensure that TAR directory entries are created - so I find this workaround acceptable, i.e I don't see a need to change smth in [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] or Maven Assembly Plugin to create TAR directory entries implicitly - one may not need these at all - i.e. if it's acceptable to create directories with default permissions then one may want to omit TAR directory entries and keep just TAR file entries and so optimize TAR. > Owner and group of files and directories > ---------------------------------------- > > Key: MASSEMBLY-918 > URL: https://issues.apache.org/jira/browse/MASSEMBLY-918 > Project: Maven Assembly Plugin > Issue Type: New Feature > Components: component descriptor > Affects Versions: 3.1.1 > Environment: I used different build environments for testing > https://github.com/mabrarov/dockerfile-test project. > Windows build environment: > 1. MS Windows 10 Pro 1703 > 2. Oracle JDK 1.8 update 162 > 3. Apache Maven 3.6.0 > 4. Virtual machine (VMware Workstation 12 Pro ) with > 4.1. CentOS 7 > 4.2. Docker 1.12.3 (accessible remotely via 2375 TCP port) > Linux build environment: > 1. CentOS 7 > 2. OpenJDK 1.8 update 212 > 3. Apache Maven 3.0.5 (Red Hat .0.5-17) > 4. Docker 1.13.1 > Reporter: Marat Abrarov > Priority: Minor > > This is new feature request similar to MASSEMBLY-668 and MASSEMBLY-442 (I > cannot reopen existing JIRA issues - I have no required permissions in JIRA). > Below is description of my case when I need Maven Assembly Plugin to provide > ability to specify owner and group for files and directories (I need > {{root:root}} actually). I need this ability (new feature) for TAR files > created by Maven Assembly Plugin. > I use Maven Assembly Plugin to prepare TAR, because > # I use TARs with [{{ADD}} Dockerfile > directive|https://docs.docker.com/engine/reference/builder/#add] because I > have Linux and Windows build systems so TAR is the only option to add files > into Docker image with specific Unix file permissions (thanks to {{fileMode}} > and {{directoryMode}} options of Maven Assembly Plugin) > # I have old Docker 1.13.1 (I'm limited to Red Hat Docker images and RHEL 7, > I cannot use [Podman|https://podman.io/] because it lacks remote access which > I need because of Windows is used on some development environments) and > cannot use {{ADD --chown}} Dockerfile directive or multi-stage Dockerfile > because of version of Docker > # I cannot use {{RUN}} Dockerfile directive to change Unix file permissions > and / or owner / group because it duplicates files added with {{ADD}} or > {{COPY}} Dockerfile directives (the only simple way to add results of build > into Docker image). Refer to [The backlash of chmod/chown/mv in your > Dockerfile|https://medium.com/@lmakarov/the-backlash-of-chmod-chown-mv-in-your-dockerfile-f12fe08c0b55] > for details. > When I build on Windows - refer to > [dockerfile-test|https://github.com/mabrarov/dockerfile-test] test project - > then files are added with {{root:root}} owner (that's acceptable for my > case). This can be tested with below commands (launche Docker container, so > require Docker): > {code:java} > $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app > $ docker run --rm abrarov/dockerfile-test/app-image ls -lha /app/bin > {code} > It looks like this new feature requires changing of > [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] which is > used by Maven Assembly Plugin. > I created PoC which works with some minor notes: > # Changes in > [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] can be > found in > [feature/MASSEMBLY-668|https://github.com/codehaus-plexus/plexus-archiver/compare/master...mabrarov:feature/MASSEMBLY-668] > branch of > [mabrarov/plexus-archiver|https://github.com/mabrarov/plexus-archiver] GitHub > repository > ## Tests for new code are missing > ## JavaDoc and comments for new code are missing > ## Only TAR implementation is extended and tested manually > # Changes in Maven Assembly Plugin can be found in > [feature/MASSEMBLY-668|https://github.com/apache/maven-assembly-plugin/compare/master...mabrarov:feature/MASSEMBLY-668] > branch > ## Tests for new code are missing > ## Only TAR format, {{fileSets}} and {{dependencySets}} sections of Maven > Assembly descriptor are tested manually > ## Existing tests are broken because of mocking and verification which need > to be adopted - build works only with {{-DskipTests}} > ## JavaDoc and comments for new code are missing > # Changes in test project utilizing this new feature can be found in > [feature/root_owner_in_docker_image|https://github.com/mabrarov/dockerfile-test/compare/feature/root_owner_in_docker_image] > branch of > [mabrarov/dockerfile-test|https://github.com/mabrarov/dockerfile-test] GitHub > repository > ## I had to add each directory (where I need to specify owner and group) > explicitly (even parent directories) because TAR format supports permissions, > owner and group of directory only if TAR directory entries are added. This is > true for permissions too ({{directoryMode}} option in Maven Assembly Plugin > descriptor), so it's existing issue of Maven Assembly Plugin - when you need > to store permissions for directories in TAR then you have to add directories > explicitly to ensure that TAR directory entries are created - so I find this > workaround acceptable, i.e I don't see a need to change smth in > [Plexus-archiver|https://github.com/codehaus-plexus/plexus-archiver] or Maven > Assembly Plugin to create TAR directory entries implicitly - one may not need > these at all - i.e. if it's acceptable to create directories with default > permissions then one may want to omit TAR directory entries and keep just TAR > file entries and so optimize TAR. -- This message was sent by Atlassian JIRA (v7.6.14#76016)