-
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
Jib in Pipeline with non root user #2437
Comments
Closing this as a dup of #2438. I believe the root issue is unrelated to Jib; the issue is that you just cannot run Gradle inside Tekton whether or not you use Jib. BTW, I don't understand these commands:
Downloading a wrapper in a Tekton step doesn't make sense at all because the Tekton step is running on the image |
FTR: issue resolved after @2020testuser configured a Tekton Task so that Gradle can create necessary files. |
@chanseokoh - Could you please confirm on the below?
I believe I don't need the below volume mounts as my /.gradle is under /workspace/.gradle. I had to change the mountpaths to /workspace/.gradle below. Is that correct? Also, since, /workspace is in PVC, caching these in PVC, would improve my build performance.
|
@2020testuser basically you're right. I see that
then because everything is persisted, I think you don't really need all those extra mount points coming from the Jib Gradle catalog. (Definitely you don't need to think about |
@chanseokoh - Thanks Much! I also tested. I'm not clear on the below you mentioned. Since, I have the /workspace as persistent volume, technically, workspace/.gradle/caches, /workspace/.m2, etc should be still available for next time build (task pod) even if my task (pod) gets completed. Looks like I'll have to do some reading on this. If you have any related info. could you please share? Thanks!
|
You understood it right. I was just saying that, even if you mounted a volume at That said, I don't know if persisting everything under And you said you store project source files in a volume. Why? I think it's unusual to cache a source project that is available on a Git repository. Normally, you'll make Tekton pull in the Git repo at runtime. |
@chanseokoh - I get it now. I use persistent volume. Yes , I use Tekton (git clone task) to pull the source from git repo and dump into persistent volume. My plan is to delete the source from persistent volume after successful build. But, don't delete the cache directories as my build will be fast next time. Thanks ! |
Hi,
Could you please let me know whether Gradle 4.6 image (from docker hub) with Jib need user -root to run in Kubernetes pod? Below is the yaml file content sample.
Gradle 4.6 image in Docker Hub need to run as user -root and fails for all other users when run in Kubernetes Pod.
Expected Behavior
Gradle 4.6 image must be able to run as user - gradle or user - 1000 when initiated in Kubernetes pod whose securitycontext is set to user - root and group as root.
Current Behavior
Gradle 4.6 image works only for user root in Kubernetes pod and fails for user 1000 and user - gradle in Kubernetes pod.
Context
How has this issue affected you? What are you trying to accomplish? I'm trying to run gradle image from within Kubernetes Pod as non-root user.
Steps to Reproduce
sample code above
Your Environment
Gradle 4.6 image pulled from Docker hub and pushed to company's Docker registry.
The Gradle 4.6 image when run in Kubernetes Pod as user -root , the application build is successful. The Gradle 4.6 image when run in Kubernetes Pod asnon-root user , the application build fails.
Exception Message is below.
[service-build-step] 07:43:25.705 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type CrossBuildFileHashCache using BuildSessionScopeServices.createCrossBuildFileHashCache(). [service-build-step] 07:43:25.705 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.invokeMethod(DefaultServiceRegistry.java:857) [service-build-step] 07:43:25.705 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.service.DefaultServiceRegistry$FactoryService.create(DefaultServiceRegistry.java:808)
I tried passing -u - root, -u - gradle , changing the permission of the project directory using jib.extraDirectories.permissions and no luck.
Any info. to fix this issue would be greatly helpful.
Thanks in advance!
The text was updated successfully, but these errors were encountered: