Reputation: 339
I'm running Jenkins agent in K8s nodes.
I add git config --global http.sslVerify false
in dockerfile. I also add ~/.gitconfig
in dockerfile too.
I try to use Jenkins checkout
and git
in pipeline to fetch codes, but I got following error:
stderr: fatal: unable to access 'https://gitlab-ops.prod.hccn/iac/gitops/vsphere_linux.git/': SSL certificate problem: unable to get local issuer certificate
But if I replace them by sh git clone
command, it's ok.
So here are my questions:
git config --global http.sslVerify false
is only works for git
command, don't work for Jenkins checkout
and git
, right? Because git
command is a sh command, but Jenkins checkout
git
is some kind of Java plugin?checkout
also reference git
or gitclient
plugin?checkout
and git
plugin SSL verify? I don't find them on jenkins git-client plugin or jenkins git plugin or jenkins scm pluginSupplement:
git config --global http.sslVerify false
on each k8s nodeSupplement 2:
I have 2 git project. The Jenkinsfile
is in the first one, which configure in the Jenkins Job. The default checkout is working well. During the pipeline running, it will try to pull another git project on the Jenkins agent, this is where the problem arises.
Upvotes: 2
Views: 1836
Reputation: 1324268
Using the Jenkins Git client plugin, I would avoid JGit (set in this setting)
I would:
git
is in the $PATH
of the Jenkins Controller (formerly known as "master")Then the global setting http.sslVerify
would be enforced.
Although, as seen here, JGit should also be able to read the same setting.
From the comments/discussion, the OP Bryan Chen adds:
I have two git project.
The Jenkinsfile is in the first one, which configure in the Jenkins Job. The default checkout is working well.
During the pipeline running, it will try to pull another git project on the Jenkins agent, this is where the problem arises.
That means the root cause seems to be within the container executing the job as an agent (in a container), not in the main Jenkins controller.
Upvotes: 0