api4jenkins icon indicating copy to clipboard operation
api4jenkins copied to clipboard

SSL check false

Open JayChanggithub opened this issue 2 years ago • 9 comments

Hi, I got following error, have anything else parameters to false check certificates?

Max retries exceeded with url: /crumbIssuer/api/json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)')))

JayChanggithub avatar Aug 15 '22 14:08 JayChanggithub

have you set correct Jenkins URL in system configuration ?

joelee2012 avatar Aug 16 '22 00:08 joelee2012

@joelee2012 I am sure system configuration is right. In addition i adopt to invoke from jenkinsapi.jenkins import Jenkins as long as False SSL check is work fine. So i wanna to know api4jenkins have anything else possible to do same configuration? Thanks you

JayChanggithub avatar Aug 17 '22 10:08 JayChanggithub

yes, it does, any parameter supported by requests can be used to init Jenkins, see : https://api4jenkins.readthedocs.io/en/latest/user/example.html#jenkins, example to disable ssl verify:

from api4jenkins import Jenkins
client = Jenkins('http://127.0.0.1:8080/', auth=('username', 'password or token'), verify=False)

joelee2012 avatar Aug 18 '22 05:08 joelee2012

Hi @joelee2012, Thanks for you reply i will try it.

JayChanggithub avatar Aug 18 '22 05:08 JayChanggithub

I will feedback here. Exactly when added the "verify=False" it's would be fine.

JayChanggithub avatar Aug 20 '22 03:08 JayChanggithub

@joelee2012 in addition. I try to use "job.build" to build with parameters. Have anything possible through the **parameters to do?

par  =  [
     "TEST_TARGET=rm-sit3",
     "TEST_NAME=ReturnSitTests",
      "USERS_NUMBER=1",
      "TENANT=rm-sit3-02",
       "SLACK_SEND=true"
 ]
          
"""
job.build(arg1='string1', arg2='string2')
"""
 
 job.build(
     *par
 )

JayChanggithub avatar Aug 20 '22 05:08 JayChanggithub

yes, use dict, here is code snippet

parameters = {'arg1': 'values', 'args': 'value2'}
job.build(**parameters)

joelee2012 avatar Aug 20 '22 06:08 joelee2012

, verify=False

Hello,

Works fine but still have warnings. Is it possible to remove them ?

connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'xxxxxxxxxx'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn( connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'xxxxxxxxxxx'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(

spiralcb avatar Oct 25 '22 07:10 spiralcb

the warning tells the answer https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings , add snippet before your code

import urllib3
urllib3.disable_warnings()

joelee2012 avatar Oct 25 '22 09:10 joelee2012