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

Set gid #124

Merged
merged 1 commit into from
Feb 3, 2022
Merged

Set gid #124

merged 1 commit into from
Feb 3, 2022

Conversation

dmikusa
Copy link

@dmikusa dmikusa commented Feb 2, 2022

Summary

Allows setting the --gid flag to pack build.

Use Cases

When running on Github Actions, the host user is 1001. The CNB user in the container is 1000. If you mount a volume in from the host, you cannot write to the volume, because 1000 != 1001. You cannot change the host file owner because the action runs as a non-root user. In addition, you cannot change the user id in the container.

You can set group writable on the host OS & set pack build --gid 121 (121 is the group on GHA). Then when mounted into the container, the volume is group writable and the build runs with a matching group id, thus you can write to the volume.

The need for this is to enable more efficient caching in Paketo Java sample apps. If we can write to ~/.m2 and ~/.gradle which are volume mounted in from the host, we can share and reuse a lot of files, reducing the test times significantly.

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@dmikusa dmikusa added the enhancement A new feature or request label Feb 2, 2022
@dmikusa dmikusa requested a review from a team as a code owner February 2, 2022 22:05
@ForestEckhardt
Copy link
Contributor

@dmikusa-pivotal This PR appears to be built on top of your other open PR. Are they intertwined or was this just an accident? If it was just an accident then if you can rework this so that it is not built on your previous commit that would be appreciated.

@dmikusa
Copy link
Author

dmikusa commented Feb 3, 2022

I can resubmit it. I wasn't sure if the other one would get in first since it was submitted first. They are unrelated, so I can resubmit it based on main. One sec.

This adds 'WithGID' which allows you to set the `--gid` flag for `pack build`.

Signed-off-by: Daniel Mikusa <[email protected]>
@dmikusa
Copy link
Author

dmikusa commented Feb 3, 2022

Should be all set now @ForestEckhardt

@ForestEckhardt ForestEckhardt merged commit aca3411 into paketo-buildpacks:main Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants