Jenkins - No Jenkins User, Unable to find commands - jenkins

I am not entirely sure I am on the right track. I have Jenkins installed on a Mac - this was installed by someone else, but I gather this is a homebrew installation. It under /Users/$USER/.jenkins
The system does not show a jenkins user, which is something I have not seen in an instance of jenkins before. Jenkins is being used to run automated builds, but consistently cannot find commands that are available via terminal when I attempt them (ex: appium, node). I am trying to launch appium via the 'execute shell' step.
I am unsure where to go from here. Using a full directory path does not seem to help.
One thing to note is that Jenkins can successfully use the Android SDK it self-installed. It installed the Android SDK even though the box it is running on already had Android SDK installed. Jenkins doesn't seem to be aware of things happening outside of its own context.
Can anyone shed some insight on what the issue may be? I have spent quite a number of hours searching and cannot seem to resolve this on my own.

Related

Missing build from jenkins

I ran a build yesterday, hoping I would read some logs today.
I came today, and got an error 404 when trying to access the build. Strange.
Running another build, shows my build actually did run, but it is unreachable.
Is there a way to get my hands on the logs?
Notice build #10 is missing, even though it did start.
Probably a windows update is to blame for this.
The broken link is http://192.168.80.10:8080/job/Dev_git/10
More information on a run can usually be found using the context menu under Console Output. This is only accessible if you have the correct permissions set in Jenkins.
This of course does not work, if a build is missing. One reason could be that your Jenkins is configured in a way that only a certain number of historic builds are kept, see Build History Missing in Jenkins for an explanation how to deal with that.
However, your case seems to be different, because a build in the middle of the history is missing. For this, I suggest to look around in the jobs directory of your Jenkins installation where it stores all the configuration and run data.
References
https://wiki.jenkins.io/display/JENKINS/Administering+Jenkins
Where does Jenkins store configuration files for the jobs it runs?

Jenkins detecting more than one instance

I realize that this question has been asked before but I feel like my case is different.
About five hours after I launch jenkins I sometimes see this message appear when loading the jenkins administrator panel:
Jenkins detected that you appear to be running more than one instance of Jenkins that share the same home directory '’. This greatly confuses Jenkins and you will likely experience strange behaviors, so please correct the situation."
This is strange, it happens every time I launch it, eventually making Jenkins unusable. I installed Jenkins via homebrew and launch is via the jenkins CLI. I manually do this so I don't see how it's possible that Jenkins launches twice.
I reinstalled Jenkins after completely removing it. Still no luck.
Anyone have any issues like this before?
I also had a similar problem and solved it with following checks:
Check if another java process is running which runs jenkins e.g. in unix using top
If you're using tomcat, search for a second instance of tomcat having the jenkins.war exploded somewhere
Could be helpful to just have one version of java installed

Jenkins: Keep older build running if new build fails to deploy

I'm new to jenkins.
For that sake I installed the latest version of jenkins i.e. 1.632 on my ubuntu and deployed a war using post build actions in the configuration part. That worked fine for me.
Then I changed a few things in the build making sure that it fails when deployed and it effectively did and I'm not able to access the application die to deployment failure.
But I'm curious here, I have heard that in case of a build failure jenkins makes sure that the previous build remains deployed so that the application is always up and running. Please clarify if I'm wrong or doing anything wrong in my deployment steps.
I did searched a lot about this but couldn't find a valuable answer.
Haven't done much with the deploy plugin but it states this in the docs
Now when you trigger this job you can enter the build number (or use
any other available selector) to select which build to redeploy.
So you can set up a build on failure which will redeploy the last stable version. Here is also an example how to get the last stable build number:
http://<JENKINS>/job/<JOB_NAME>/lastStableBuild/buildNumber

Jenkins slave agent service do not work since java update (which removed medium security level)

Situation:
Yesterday morning, all of our Slaves had problems (because thanks to Java, which removed the medium security level, the Jenkins slave agent could not be launched anymore). Java then started blocking all Jenkins slave agent.jlnp, we had to add on every slave an exception for our jenkins server, so the slave application can be launched. This was annoying but now they work. (was there an easier solution?)
Few slaves had Jenkins installed as a service (to be launched automatically on startup). However, since yesterday, they do not launch anymore, and we cannot find why. It probably has to do with the security from Java.
Someone has any idea?
You need to update jenkins reference to Java. It is in file C:\Jenkins\jenkins-slave.xml (or whereever is your Jenkins folder). When you updated Java Jenkins no longer knows where to find new version
Mine looks something like this.
<executable>C:\Program Files (x86)\Java\jre1.8.0_91\bin\java.exe</executable>
I made it works with the following steps:
1-) Uninstalling service
2-) Reboot
3-) Installing service
4-) Reboot

Jenkins Update Loses Old Jobs

I am on a redhat linux box. I recently updated Jenkins to version 1.509 only to find that after doing so it has "forgotten" two of my jobs/projects. The jobs can still be found on my Jenkins machine under /var/lib/jenkins/jobs, but they no longer show up in the Jenkins GUI. I attempted to re-create them based off the configuration file I have, but I am not confident I have totally re-created the functionality they had.
I also tried to copy the job and or rename it hoping that would get jenkins to see it, but no luck. I had tried cp -r /var/lib/jenkins/jobs/JOB1 /var/lib/jenkins/jobs/JOB2. I also restarted the service a number of times. Finally I updated all of my plugins on the off chance that was somehow related.
So my question is "How can I get Jenkins to notice these jobs?" or failing that "can I run these jobs from in the terminal?"
NOTE: I am not discouraging others from upgrading Jenkins. After I upgraded Jenkins did complain about a number of things which I didn't pay enough attention to which I believe got me into this mess in the first place.
If I were you, I would try the Jenkins CLI (from $JENKINS_URL/cli) and use the create-job command and feed the job configuration file to the cli's stdin.
If that does not help, I would inspect Jenkins log files (you are saving stdout and stderr of Jenkins somewhere, right?) for any errors or clues. If the job failed to load because of some tag that you can guess is provided by a plugin, try to remove that part from the config file.
If that does not help, I would upgrade Jenkins. I think there might be some fixes related to this in the LTS version changelog since 1.509.
And above all... if I were you, I would start making backups of the job configuration files.
I regularly back up the global config.xml, all the job config.xml files and all the plugins. Using these I can set up my Jenkins from scratch. And I do that to set up a test instance where I try any plugin or Jenkins core upgrade. If I see no problems after running a few of the trickiest builds, I know I can upgrade the production instance with much more confidence.

Resources