Jenkins as a deamon
Hi all, I think I have a simple question for you but really important for me : How to prevent Jenkins to change its PID after a Jenkins restart (ex: Jenkins update or plugin update)? I really need this behavior to have working daemon scripts because they use the PID to know the status of the Jenkins process. If the Jenkins PID changes, the script is lost. For information, here is the command the deamon use to run Jenkins: /usr/bin/daemon --name=myjenkins --inherit --env=JENKINS_HOME=/home/myjenkins --output=/var/log/ci/myjenkins.log --pidfile=/var/run/jenkins/myjenkins.pid -- /usr/bin/java -jar /home/myjenkins/jenkins.war --webroot=/home/myjenkins/.jenkins/war --httpPort=17001 --ajp13Port=-1 --httpsPort=-1 --prefix=/myjenkins Thanks for any answer. Berst regards, Christophe. smime.p7s Description: S/MIME cryptographic signature
Re: how to enable CORS with Jenkins; or add CORS to Jenkins?
Hi Alexis Is your filter now setup to allow CORS properly? I need it to access jenkins apis through my JS sitting on my localhost. If yes, can you point to the setup instructions. If no, can you help with an easy and quick alternative to do POST on jenkins APIs. Thanks Anurag On Wednesday, 10 April 2013 15:36:56 UTC+5:30, Alexis Gallagher wrote: Hi, Following advice here, I have been working on implementing a Jenkins plugin that enables CORS on Jenkins: https://github.com/algal/cors . It's almost working -- the servlet filter which implements CORS (based on a fixed version of the one in jetty), the integration of the servlet filter into Jenkins, the UI for configuring the plugin, the help for configuring the plugin. But I'm still confused about how to bind the plugin's fields to the jelly files correctly. In particular, I understand that I should be making calls to save() in my plugin's configure() method, and a call to load() in the plugin's constructor. But, for instance, if I uncomment save() in line 177 of https://github.com/algal/cors/blob/master/src/main/java/org/jenkinsci/plugins/cors/PluginImpl.java then I get an OutOfMemoryError a few seconds after I hit Apply on the Jenkins UI for system configuration. And if I uncomment the load() call in lines 78-83, then I need to handle exceptions that none of the other plugin examples seem to handle. I'd really appreciate any advice. Part of the problem, perhaps, is that I need to extend hudson.Plugin in order to make use of the setServletContext() method, but I can't find any other plugins that actually work by extending hudson.Plugin, so I may be missing something about how that class should be implemented differently. Thanks, A On Wednesday, April 3, 2013 5:52:29 PM UTC+1, Alexis Gallagher wrote: Hi, I'm wondering if anyone has had any success setting up Jenkins with cross origin resource sharing (aka, CORS, as described at http://enable-cors.org or more formally at http://www.w3.org/TR/cors/ ). Enabling CORS would let you call the Jenkins REST API from javascript, so you could setup a simplified webpage for triggering builds, setting parameters for triggering builds, observing the status of builds, etc.. One way to enable CORS would be to run Jenkins under Apache or some other server, and setup the CORS configurations on that server. So this is my first question: has that worked for anyone? An alternative way, which I would ideally prefer, is to do it all within Jenkins using Jenkins's embedded server, since this would make it easier to administer. (Is that nuts?) The embedded Winstone servlet container does not offer configurations for CORS. However, I've found two open source java servlet filters that implement CORS (the one in jetty, and another one here ( http://software.dzhuvinov.com/cors-filter.html ). So I could adapt one of those servlet filters and then provide CORS either via a Jenkins plugin or via a patch on Jenkins itself. So this leads to my other questions: Is this the sort of functionality that could be implemented through a plugin? One subtlety of CORS is that it's not just a mechanism for filtering requests and decorating responses. It also requires generating responses for http OPTIONS requests, for the CORS preflight requests. I haven't seen any existing Jenkins plugins that do anything similar, so I'm not sure if the plugin system would allow it. If this functionality could not be enabled via a plugin, would a patch for it be useful to others and welcome? Alexis -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Plugin not shown up
Did you ever find out what your problem was? I am currently facing the exact same issue. I tried uploading via Advanced tab as well was as dropping it directly into the plugins folder. I can see the plugin getting extracted there but neither activated nor listed in the Installed tab. However, it works when starting it locally from my sources. No issues mentioned in the logs Any ideas? Thanks, Markus Am Freitag, 2. August 2013 18:02:17 UTC+2 schrieb Zhengyuan Shen: Hi, Thank you for your reply. I have checked and the hudson.Extension file does exists. I have run mvn install/ mvn package for loads of times, and it still doesn't work. It works in my local Jenkins and it just doesn't work in the other Jenkins in the server. Is it possible that I messed up setups in the Jenkins? Thanks, On Thursday, August 1, 2013 6:04:55 PM UTC-7, Hugh Perkins wrote: hudson.Extension is built by the sezpoz annotation processor. The maven goal associated with this is 'compiler:compile'. This file will be in your plugin project directory in the 'target/classes' subdirectory, ie 'target/classes/META-INF/annotations/hudson.Extension You want to first check whether the file exists in target/classes/META-INF/annotations/hudson.Extension. If it does, then there's an issue with your packaging. Retry 'mvn -DskipTests install' or 'mvn -DskipTests package'. If the file doesn't exist, then the annotation processor didn't run - are you sure you have at least one class annotated with @Extension? - try running 'mvn clean' followed by 'mvn compile', which will trigger the goal 'compiler:compile' -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Plugin not shown up
I found out myself, that I had actually had an exception thrown regarding the ui-samples-plugin dependency. Therefore the plugin wasn't loaded Am Montag, 2. September 2013 17:22:33 UTC+2 schrieb Markus W.: Did you ever find out what your problem was? I am currently facing the exact same issue. I tried uploading via Advanced tab as well was as dropping it directly into the plugins folder. I can see the plugin getting extracted there but neither activated nor listed in the Installed tab. However, it works when starting it locally from my sources. No issues mentioned in the logs Any ideas? Thanks, Markus Am Freitag, 2. August 2013 18:02:17 UTC+2 schrieb Zhengyuan Shen: Hi, Thank you for your reply. I have checked and the hudson.Extension file does exists. I have run mvn install/ mvn package for loads of times, and it still doesn't work. It works in my local Jenkins and it just doesn't work in the other Jenkins in the server. Is it possible that I messed up setups in the Jenkins? Thanks, On Thursday, August 1, 2013 6:04:55 PM UTC-7, Hugh Perkins wrote: hudson.Extension is built by the sezpoz annotation processor. The maven goal associated with this is 'compiler:compile'. This file will be in your plugin project directory in the 'target/classes' subdirectory, ie 'target/classes/META-INF/annotations/hudson.Extension You want to first check whether the file exists in target/classes/META-INF/annotations/hudson.Extension. If it does, then there's an issue with your packaging. Retry 'mvn -DskipTests install' or 'mvn -DskipTests package'. If the file doesn't exist, then the annotation processor didn't run - are you sure you have at least one class annotated with @Extension? - try running 'mvn clean' followed by 'mvn compile', which will trigger the goal 'compiler:compile' -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
ToolInstaller, PATH and environment
Hi, I'm working on https://github.com/ndeloof/bees-sdk-plugin plugin manage a ToolInstaller and a BuildWrapper to expose tool in PATH to know tool installation folder, I need AutoInstaller to have installed the tool, so I moved it to decorateLauncher - but it's seem it's to late to contribute environment with PATH+FOO hack Any guidance on contributing to PATH environment from a ToolInstaller would be appreciated I also wonder my ToolInstallations aren't persisted. I added save() and load() to my ToolDescriptor, seems odd having to do this. -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Jenkins as a deamon
Hi, I don't think you can set a specific PID for any process. Moreover, I don't think you can obtain the correct status of Jenkins via its process. Instead, you can access its status (or deduct it) via many ways including : - Jenkins cli API : see https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI - Jenkins rest API : see https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API - curl/wget to Jenkins home page via script Hope this help. 2013/9/2 Christophe Demarey christophe.dema...@inria.fr Hi all, I think I have a simple question for you but really important for me : How to prevent Jenkins to change its PID after a Jenkins restart (ex: Jenkins update or plugin update)? I really need this behavior to have working daemon scripts because they use the PID to know the status of the Jenkins process. If the Jenkins PID changes, the script is lost. For information, here is the command the deamon use to run Jenkins: /usr/bin/daemon --name=myjenkins --inherit --env=JENKINS_HOME=/home/myjenkins --output=/var/log/ci/myjenkins.log --pidfile=/var/run/jenkins/myjenkins.pid -- /usr/bin/java -jar /home/myjenkins/jenkins.war --webroot=/home/myjenkins/.jenkins/war --httpPort=17001 --ajp13Port=-1 --httpsPort=-1 --prefix=/myjenkins Thanks for any answer. Berst regards, Christophe. -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: ToolInstaller, PATH and environment
inspired by other plugins (custom-tools, nodejs) I've added a DecoratedLauncher to convert proc.env into EnvVar, then let the ToolInstallation post-process, then re-convert into env. Looks os hacky I wonder there isn't a better way ... https://github.com/ndeloof/bees-sdk-plugin/commit/63eff4b438fe2c330482f61aa2cb8328ebdb832f 2013/9/2 nicolas de loof nicolas.del...@gmail.com Hi, I'm working on https://github.com/ndeloof/bees-sdk-plugin plugin manage a ToolInstaller and a BuildWrapper to expose tool in PATH to know tool installation folder, I need AutoInstaller to have installed the tool, so I moved it to decorateLauncher - but it's seem it's to late to contribute environment with PATH+FOO hack Any guidance on contributing to PATH environment from a ToolInstaller would be appreciated I also wonder my ToolInstallations aren't persisted. I added save() and load() to my ToolDescriptor, seems odd having to do this. -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Jenkins as a deamon
I believe that the restart which Jenkins starts a new process and stops the currently running process. In that case, I don't think it is possible to retain the same PID, since that would require two processes running at the same time with duplicate PID's. Mark Waite On Monday, September 2, 2013 12:58:30 PM UTC-6, mpapo - Michaël Pailloncy wrote: Hi, I don't think you can set a specific PID for any process. Moreover, I don't think you can obtain the correct status of Jenkins via its process. Instead, you can access its status (or deduct it) via many ways including : - Jenkins cli API : see https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI - Jenkins rest API : see https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API - curl/wget to Jenkins home page via script Hope this help. 2013/9/2 Christophe Demarey christoph...@inria.fr javascript: Hi all, I think I have a simple question for you but really important for me : How to prevent Jenkins to change its PID after a Jenkins restart (ex: Jenkins update or plugin update)? I really need this behavior to have working daemon scripts because they use the PID to know the status of the Jenkins process. If the Jenkins PID changes, the script is lost. For information, here is the command the deamon use to run Jenkins: /usr/bin/daemon --name=myjenkins --inherit --env=JENKINS_HOME=/home/myjenkins --output=/var/log/ci/myjenkins.log --pidfile=/var/run/jenkins/myjenkins.pid -- /usr/bin/java -jar /home/myjenkins/jenkins.war --webroot=/home/myjenkins/.jenkins/war --httpPort=17001 --ajp13Port=-1 --httpsPort=-1 --prefix=/myjenkins Thanks for any answer. Berst regards, Christophe. -- You received this message because you are subscribed to the Google Groups Jenkins Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.