I have a scenario where I want to trigger Jenkins Build with parameters remotely.
I am using following jar in my java code to connect to Jenkins:
<dependency>
<groupId>com.cdancy</groupId>
<artifactId>jenkins-rest</artifactId>
<version>0.0.25</version>
<classifier>all</classifier>
</dependency>
Following is the code snippet I use to check Jenkins version.
JenkinsClient client = JenkinsClient.builder()
// Note - I tried endpoint as https://(//my IP goes here):(//my port goes here) without /jenkins suffix. It didnt work also
.endPoint("https://(//my IP goes here):(//my port goes here)/jenkins").
credentials("username:password").build();
SystemInfo systemInfo = client.api().systemApi().systemInfo();
System.out.println(systemInfo.jenkinsVersion());
I get the following error:
SystemInfo{errors=[Error{context=null, message=Unexpected exception being thrown: error=Error{context=null, message=PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target connecting to GET host name goes here/crumbIssuer/api/xml?xpath=concat%28//crumbRequestField,%22%3A%22,//crumb%29 HTTP/1.1, exceptionName=com.cdancy.jenkins.rest.shaded.org.jclouds.http.HttpResponseException} connecting to HEAD HTTP/1.1, exceptionName=com.cdancy.jenkins.rest.shaded.org.jclouds.http.HttpResponseException}]
How do I set the SSLContext/certificate with the Jenkins client?
Or should I use any other dependency to connect to Jenkins and build a job with parameters?
Thank you in advance!