I have written ansible playbook to install cloudbees jenkins in our production VM's. While running ansible playbook for the first time, it got successful but jenkins not up and running and same playbook running in second time jenkins up and running fine.
I have manually downloaded jenkins.war(2.138.x) and moved to VM. While running ansible playbook for the first time it is executed successfully, but the jenkins is not up and running, so i went inside vm and checked jenkins home directory. It is only showing one folder i.e WAR, but while running the same playbook for the second time the jenkins is up on running and again i have logged into Vm and checked jenkins home directory. Now i can able to see all configuration files inside home directory.i have checked the logs what i have observed is first time while running the jvm lines is not taken. but while running second time i have observed some jvm related lines.But i have installed java and i set environment variables as well.
- hosts: all
become: true
become_user: user1
tasks:
- name: installing the jenkins
shell: nohup java -DJENKINS_HOME=/user1/jenkins -jar /user1/jenkins.war &
I am expecting the cloudbees jenkins installation for first time only, while running the Ansible-playbook
- hosts: all
become: true
become_user: user1
tasks:
- name: installing the jenkins
shell: cd /user1 ; nohup java -DJENKINS_HOME=/user1/jenkins -jar jenkins.war &
First change the current directory to your jenkins war file directory and then run the nohup command in remote server
Related
I have a script that create a VM then I need to add the new VM as a slave to existing master,
How can I do that from command line in windows and from the new VM ?
Create a VM (OS = WINDOWS)
Create a Node on jenkins server from command line using jenkins cli:
config.xml | ssh -l fmud -p %JNLP_PORT% %jenkins_IPADDRESS% create-node %TARGET_WIN_NODE_NAME%
Where Config.xml could be gathered from an existing slave with command:
ssh -l fmud -p %JNLP_PORT% %jenkins_IPADDRESS% get-node %TARGET_WIN_NODE_NAME%
Note: JNLP is needed for jenkins-CLI and could be configured in jenkins administrative page.
Also, you will have to change the config file with label and name etc.
Connect the windows slave as service: Download winsw.exe
Rename it to jenkins_slave.exe
Download slave.jar (http://yourserver:port/jnlpJars/agent.jar )
Download and configure jenkins-slave.xml
Download and configure jenkins-slave.exe.config
in cmd: jenkins_slave.exe install
jenkins_slave.exe start
If it is a java slave, that is simple to automate. Like it if you find it helping or ask more specific question otherwise.
I have a master and multiple slave machines. The slaves are configured to start via ssh from the master. Initially, there is a single java process running the slave.jar. Occasionally, I'll login to a slave and find that there are 2 or even sometimes 3 java processes running slave.jar. This is while no jobs are running.
How many slave processes should be running when the slave is idle?
tomcat 54054 53913 0 Sep02 ? 00:00:00 bash -c cd "/var/hudson" && java -jar slave.jar
tomcat 54055 53914 0 Sep02 ? 00:00:00 bash -c cd "/var/hudson" && java -jar slave.jar
tomcat 54080 54054 1 Sep02 ? 01:11:45 java -jar slave.jar
tomcat 54081 54055 2 Sep02 ? 01:44:17 java -jar slave.jar
I had the same problem... and recognized after hours(!) of investigation, that our backup system (master) was online and connected to the same slaves (a backup was installed there for test reasons).
Each time-triggered build was triggered nearly at the same time and failed completetly randomly in about a third of the builds jobs executed.
So perhaps there's really another master connecting to your slaves?
I am trying to run command docker-compose up -d as a build step of Jenkins, in "execute shell". Job fails and gives me following console log:
docker-compose up --build -d
Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Build step 'Execute shell' marked build as failure
Finished: FAILURE`
When I cd into jenkins workspace (/var/lib/jenkins/workspace/app/) and tried to run docker-compose up, at first I could get a normal build. Right now I get error in console: ERROR: Error processing tar file(archive/tar: invalid tar header):. Of course app builds and runs normally in home directory when invoked from console.
Docker is running on host. It is possible to run docker-compose by regular user. I did add jenkins user to docker group. I even tried following some asian tutorial from http://blog.csdn.net/qiyueqinglian/article/details/46559825 that made me change DOCKER_OPTS in default/docker, but after restarting docker service it was not running on port 4243, so I didn't understood translation or it is not working on ubuntu 16.04 (host system).
Jenkins is not running in container, it is casually installed on host, no VM no docker, nothing. I tried removing docker and jenkins completly from host (purge etc) and reinstalling, still the same errors.
Any ideas?
Hit this command as a root user and try again
usermod -aG docker jenkins
I am trying to integrate Jenkins and Jmeter inside the Docker. For this I am using official Jenkins docker file. My Job in Jenkins, starts the Jmeter's execution. All works fine. But after some time, the jenkins server stops (and so the docker container).
The docker logs only shows
"INFO: JVM is terminating. Shutting down Winstone".
Docker version - 17.04.0 CE,
Jmeter version - 3.1 and
Jenkins - 2.46.1
Not sure what and why JVM is terminated. Need help.
How do I update jenkins from a existing jenkins install running as a Linux service without loosing any jobs or config?
First, you need to find where your jenkins.war file is installed:
locate jenkins.war
On my Centos machine, it's here: /usr/share/jenkins/jenkins.war
Stop the Jenkins service:
service jenkins stop
Next, you can backup the existing jenkins.war file:
cd /usr/share/jenkins
mv jenkins.war jenkins-1.586.war
And to finish, please copy the new jenkins.war file in the same location:
cp jenkins.war /usr/share/jenkins/jenkins.war
Restart the Jenkins service:
service jenkins start
It should work and you should retrieve your Jenkins configuration (which is stored in your Jenkins home folder).