[JIRA] (JENKINS-50864) kubernetes-cli-plugin is not working.

2020-01-08 Thread edward.tho...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Ed Thorne commented on  JENKINS-50864  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: kubernetes-cli-plugin is not working.   
 

  
 
 
 
 

 
 For others that may be experiencing this issue, here's some information that may be useful. By default, the Jenkins environment on an RPM installed (Linux) system will look like the following: 

 

SHELL=/bin/bash
USER=jenkins
PATH=/sbin:/usr/sbin:/bin:/usr/bin
PWD=/
LANG=en_US.UTF-8
HOME=/opt/jenkins
SHLVL=2
LOGNAME=jenkins
_=/etc/alternatives/java
 

 The recommended installation instructions for kubectl on Linux have the binary installed in /usr/local/bin (not in the default path of Jenkins). Even though /usr/local/bin is in the path in bash shells, it's not in the daemon's path with the default settings. Using the PATH+WHATEVER pattern you can get /usr/local/bin in the path for shells, but not the Jenkins process. This allowed me to work around the issue in this way: 

 

withKubeConfig([
credentialsId: '7a1146c7-1791-4197-a8fd-f6a97abec862'
// , contextName: contextName
]) {
// switch context from default to target environment
sh "kubectl config use-context ${contextName}"
// deploy the resources (without pushing)
sh 'kubectl apply -k .'
// wait for deployment to complete
sh "kubectl rollout status deployment/${projectName} --timeout=2m"
}
 

 If I tried to set the context name in the parameter, I got the exception observed in this ticket. This likely stems from the launcher not understanding the PATH+WHATEVER modifications that add /usr/local/bin to the path for pipeline shell commands that you can see above. This feels like a shortcoming of the plugin documentation in that the kubectl binary must be in the path visible to the Jenkins process(es) which can be considerably different from traditional login shell paths or even pipeline shell paths. With the documented installation location as /usr/local/bin, I'm surprised more instances of this haven't occurred.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
  

[JIRA] (JENKINS-19725) Unable to unmarshall response (Couldn't initialize a SAX driver to create an XMLReader)

2016-11-18 Thread edward.tho...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Ed Thorne commented on  JENKINS-19725  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Unable to unmarshall response (Couldn't initialize a SAX driver to create an XMLReader)   
 

  
 
 
 
 

 
 I'm seeing a similar exception when performing a multipart upload (File > 16MB) ERROR: Build step failed with exception com.amazonaws.AmazonClientException: Couldn't initialize a SAX driver to create an XMLReader at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.(XmlResponsesSaxParser.java:85) at com.amazonaws.services.s3.model.transform.Unmarshallers$InitiateMultipartUploadResultUnmarshaller.unmarshall(Unmarshallers.java:235) at com.amazonaws.services.s3.model.transform.Unmarshallers$InitiateMultipartUploadResultUnmarshaller.unmarshall(Unmarshallers.java:232) at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(S3XmlResponseHandler.java:62) at com.amazonaws.services.s3.internal.ResponseHeaderHandlerChain.handle(ResponseHeaderHandlerChain.java:44) at com.amazonaws.services.s3.internal.ResponseHeaderHandlerChain.handle(ResponseHeaderHandlerChain.java:30) at com.amazonaws.http.response.AwsResponseHandlerAdapter.handle(AwsResponseHandlerAdapter.java:70) at com.amazonaws.http.AmazonHttpClient.handleResponse(AmazonHttpClient.java:1240) at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:929) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:738) at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:489) at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:448) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:397) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:378) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4039) at com.amazonaws.services.s3.AmazonS3Client.initiateMultipartUpload(AmazonS3Client.java:2888) at com.amazonaws.services.s3.transfer.internal.UploadCallable.initiateMultipartUpload(UploadCallable.java:350) at com.amazonaws.services.s3.transfer.internal.UploadCallable.uploadInParts(UploadCallable.java:178) at com.amazonaws.services.s3.transfer.internal.UploadCallable.call(UploadCallable.java:121) at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:139) at com.amazonaws.services.s3.transfer.internal.UploadMonitor.call(UploadMonitor.java:47) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230) at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191) at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.(XmlResponsesSaxParser.java:83) ... 24 more Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403) at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82) at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228) ... 26 more Build step 'Publish artifacts to S3 Bucket'