I have camel-k installed in a kubernetes cluster and in that there is a route to checkout a git repository as follow.
// camel-k: language=java dependency=camel-git
import org.apache.camel.builder.RouteBuilder;
public class Gitlab extends RouteBuilder {
@Override
public void configure() throws Exception {
from("git:///tmp/config-service?remotePath=https://xxx&branchName=master&type=branch&username=xxx&password=xxx")
.transform().constant("checked-out").to("log:info");
}
}
But this gives the below permission error. When logged into the pod and tried to create a file or folder inside the deployment directory its giving a permission error. Is there any way to set the User inside the container with Traits or any other method?
2020-10-06 11:31:46.667 ERROR [main] SystemReader - Creating XDG_CONFIG_HOME directory /deployments/?/.config failed
java.nio.file.AccessDeniedException: /deployments/?
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:689) ~[?:?]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:796) ~[?:?]
at java.nio.file.Files.createDirectories(Files.java:782) ~[?:?]
There are 2 parts in fixing this problem.
Firstly to work around the
XDG_CONFIG_HOME
problem, you can set a environment variable for the integration like:Second, the camel-git consumer can only do simple tasks on an existing Git repository like listing branches, tags & commits. To clone a repository you need to use the producer like: