pythonssljenkinsjenkins-job-builder

Build job in Jenkins through python script SSL connection


I want to build a job in jenkins through python script.I am totally new to python.I am using below method from python-jenkins.my jenkins url is https.

 server = jenkins.Jenkins(ci_jenkins_url, username=username, password=token)

and i am getting

SSLError: HTTPSConnectionPool(host='{myjenkinsur}', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')])")))

how can I connect through SSL?


Solution

  • Try setting ssl_verifiy to False

    server = jenkins.Jenkins(ci_jenkins_url, username=username, password=token, ssl_verify=False)
    

    If you get error with the above command, then try the below one

    server = jenkins.Jenkins(ci_jenkins_url, username=username, password=token)
    server._session.verify = False