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

Jib-gradle not working on OpenShift #198

Closed
piyush-garg opened this issue Feb 27, 2020 · 10 comments · Fixed by #199 or #214
Closed

Jib-gradle not working on OpenShift #198

piyush-garg opened this issue Feb 27, 2020 · 10 comments · Fixed by #199 or #214

Comments

@piyush-garg
Copy link
Contributor

Expected Behavior

It should run as successful

Actual Behavior

Its failing.

Steps to Reproduce the Problem

  1. Use the steps mentioned in readme

Logs

{"level":"info","ts":1582729480.7104826,"logger":"fallback-logger","caller":"logging/config.go:69","msg":"Fetch GitHub commit ID from kodata failed: \"KO_DATA_PATH\" does not exist or is empty"}
FAILURE: Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
{"level":"info","ts":1582729480.8973973,"logger":"fallback-logger","caller":"logging/config.go:69","msg":"Fetch GitHub commit ID from kodata failed: \"KO_DATA_PATH\" does not exist or is empty"}
2020/02/26 15:04:49 Skipping step because a previous step failed
time="2020-02-26T15:04:41.41110257Z" level=warning msg="No HTTP secret provided - generated random secret. This may cause problems with uploads if multiple registries are behind a load-balancer. To provide a shared secret, fill in http.secret in the configuration file or set the REGISTRY_HTTP_SECRET environment variable." go.version=go1.11.2 instance.id=fb6b0671-f43e-4b15-973f-9ed5ed6d8529 service=registry version=v2.7.1 
time="2020-02-26T15:04:41.411179603Z" level=info msg="redis not configured" go.version=go1.11.2 instance.id=fb6b0671-f43e-4b15-973f-9ed5ed6d8529 service=registry version=v2.7.1 
time="2020-02-26T15:04:41.411334605Z" level=info msg="Starting upload purge in 26m0s" go.version=go1.11.2 instance.id=fb6b0671-f43e-4b15-973f-9ed5ed6d8529 service=registry version=v2.7.1 
time="2020-02-26T15:04:41.420766785Z" level=info msg="using inmemory blob descriptor cache" go.version=go1.11.2 instance.id=fb6b0671-f43e-4b15-973f-9ed5ed6d8529 service=registry version=v2.7.1 
time="2020-02-26T15:04:41.421131829Z" level=info msg="listening on [::]:5000" go.version=go1.11.2 instance.id=fb6b0671-f43e-4b15-973f-9ed5ed6d8529 service=registry version=v2.7.1 

Additional Info

@piyush-garg piyush-garg mentioned this issue Feb 27, 2020
3 tasks
piyush-garg added a commit to piyush-garg/catalog that referenced this issue Feb 27, 2020
This wil fix the issue jib gradle task
gettng failed on security constrained
environments like OpenShift

Fix tektoncd#198
tekton-robot pushed a commit that referenced this issue Feb 27, 2020
This wil fix the issue jib gradle task
gettng failed on security constrained
environments like OpenShift

Fix #198
@vdemeester vdemeester reopened this Mar 2, 2020
@vdemeester
Copy link
Member

We need to test this task (and overall all) with non-root, and be able to flag those that needs to be executed as root and those that do not.

One easy fix to this one would be to add a securityContext to runAsRoot 😓

/cc @loosebazooka @chanseokoh

@chanseokoh
Copy link
Contributor

I'd like to understand the root cause and why something breaks. Java applications (Maven, Gradle, and Jib) depend heavily on the user home directory, which changes as the user running the image changes. Note that we currently force /home/tekton as a "home" directory in the JVM due to tektoncd/pipeline#2013 (comment) (which is going to be fixed soon), but once tektoncd/pipeline#2013 is fixed, the genuine user home directly will be determined based on the image. That's why we really need a proper fix.

@piyush-garg
Copy link
Contributor Author

piyush-garg commented Mar 5, 2020

It again failed on our CI

FAILURE: Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org

Is it possible to have something working on the non-root environment like OpenShift because the flag is not the right fix as you said and tests are failing on our CI which uses OpenShift? Sorry, I don't have much idea about Gradle and Jib, can we do something else to get it fixed, above are the log?

The above issue you are mentioning will be fixed by 0.12 hopefully.

@chanseokoh
Copy link
Contributor

chanseokoh commented Mar 5, 2020

@piyush-garg for now, I think you can plug in a writable volume for CACHE.

@piyush-garg
Copy link
Contributor Author

@chanseokoh I tried a RwadWriteOnce volume and it still fails

@piyush-garg
Copy link
Contributor Author

I tried ReadWriteMany and that also fails with the same error @chanseokoh @vdemeester

@chanseokoh
Copy link
Contributor

chanseokoh commented Mar 6, 2020

I think the underlying issue is a permission problem. That is, Gradle tries to create ~/.gradle (which I believe is /home/tekton/.gradle for the time being), but perhaps it cannot create the directory as it is running as a non-root. (Or the directory exists, but you cannot write anything inside it.)

Given that, what would be an option you can think of to make this work on the OpenShift side?

@chanseokoh
Copy link
Contributor

In the meantime, I will do some experiments, but this issue is heavily related to the Tekton HOME issue (tektoncd/pipeline#2013 and tektoncd/pipeline#2165). It may take some time for the Tekton devs and me to sort this out. I'll keep looking into it.

@piyush-garg
Copy link
Contributor Author

We can run the pod as root that can be done @vdemeester WDYT?

piyush-garg added a commit to piyush-garg/catalog that referenced this issue Mar 6, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix tektoncd#198
@piyush-garg piyush-garg mentioned this issue Mar 6, 2020
3 tasks
@piyush-garg
Copy link
Contributor Author

@chanseokoh @vdemeester I have raised #214 please have a look.

piyush-garg added a commit to piyush-garg/catalog that referenced this issue Mar 6, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix tektoncd#198
tekton-robot pushed a commit that referenced this issue Mar 9, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix #198
vdemeester pushed a commit to vdemeester/tektoncd-catalog that referenced this issue Apr 9, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix tektoncd#198

(cherry picked from commit 46bdfaf)
vdemeester pushed a commit to vdemeester/tektoncd-catalog that referenced this issue Apr 9, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix tektoncd#198

(cherry picked from commit 46bdfaf)
tekton-robot pushed a commit that referenced this issue Apr 10, 2020
This will fix the issue of task not
working on OpenShift as it needs root access and
by default on OpenShift pod run as nonroot

Fix #198

(cherry picked from commit 46bdfaf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants