docker job on remote machine running but not for Jenkins - docker

I am trying to configure a docker jenkins slave on a remote machine. I have spent hours trying to make it work, but still no success.
I have installed Jenkins locally and I can make any docker job locally run without problem. I just specify a label in a jenkins pipeline like:
agent {
label 'jenkins-slave'
}
The same does not work for a remote machine. In manage jenkins > manage nodes and clouds > configure clouds I set the proper docker URI. Enabled and exposed. Test connection is ok.
I set "attach docker container" and I set the Credentials in "registry credentials".
In the remote server I can see that the docker is (correctly) started. Specifically, many dockers have being started probably because the job is trying to launch them again and again.
What I see instead in the Jenkins pipeline is this:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Still waiting to schedule task
All nodes of label ‘jenkins-slave’ are offline
I have tried tens of combinations, and different guides, but still no clue of the reason it is not working.
PS I have also disabled the firewall to see if that was the problem, but it is not.
Any other way to have more verbose logs rather than the only "all nodes of label XXX are offline"?
Thanks

Related

Fault tolerant Jenkins on DCOS

I am running a Jenkins server on DCOS as documented here https://docs.mesosphere.com/1.7/usage/tutorials/jenkins/.
The Jenkins server is able to spawn new mesos slaves when new jobs are scheduled and kill them when the job is completed.
But if a cluster node crashes, having a Jenkins job running on it, Jenkins server doesn't re-run the job on other available nodes.
Is the Jenkins service on DCOS fault tolerant?
Can we re-run the job(on some other available node) that failed due to cluster node crashed in between execution of the job?
Jenkins itself does not rerun jobs that disappear. It is not specific to DC/OS or Mesos, it's just the way Jenkins works.
DC/OS and Mesos will make sure that Jenkins stays running and available to send jobs to, and in this way, it is "fault tolerant", but in the way you are asking about it isn't.

Jenkins: how to run an exe on a remote computer

I just started using Jenkins. Still not familiar with all its features.
I would like to run a Ranorex test which is on a remote computer. How can I do that from Jenkins?
To execute binaries on a specific host, you can use slaves.
Here is a guide to setup master and slave on windows:f
https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
You will run the slave on the remote computer and connect it to the master.
To run the slave on your remote computer, you have to download the slave.jar and start it on the remote computer. This is described in the wiki article above.
You have to ensure, that your job is executed on the slave. This can be done by labels. You configure a label on the slave and configure the same label on the job too.

Jenkins trigger on-demand slaves in dockers

I'm looking for a way to run Jenkins jobs/build inside Jenkins slaves, dynamically (on-demand) started docker. Attaching schema for visual understanding.
What I'm actually looking for and my flow looks like:
1) Triggering Jenkins job (manually/git/gerrit)
2) Jenkins master (running in docker) starts slave machine docker (and pass script/instructions of the build)
3) Build is running on Jenkins slave (or slaves if parallel/pipeline)
4) Result returned to Jenkins master
5) Jenkins slave docker stops
Is it possible to do it this way?
Docker slave image creation steps like installing openssh, user creation, mentioned in the below link. Install docker plugin from the below link.
Click here!
Go to jenkins global configuration, Under cloud headings, docker configuration will be there, enter docker host url with port number, credential not required. give some values for connection timeout & read timeout.
Under docker template - Enter the docker image name which we created in the point number 1.
Set Label number (Give this label name during Jenkins job creation and restrict to this slave name),
Select the usage option - > only build job with label restriction.
No of executor -> minimum 1. Select launch method as ssh, enter the user credential to login, which we created in docker image in the step number 1.
create a job restrict to docker slave label, run, ondemand it wil spun up container.
Use this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Yet+Another+Docker+Plugin
After instalation (it requires Java 1.8) naviaget to configuration. There are two steps:
configure docker "cloud"
add "instances" (docker images) you want to run the build on
Every image should have label assigned - use this label in you job configuration to tell Jenkins explicitlyon which node the job should be run

Jenkins Jobs are not to be seen after network issue

Today morning, we noticed all Putty Jobs running Jenkins were closed due to Network Issue. Once network was up, we re-started Jenkins and we observed that Jenkins Dashboard was not showing ANY jobs. We had around 80 Jobs on the dash board. We are using VM servers for Master/Slave setup. Config.xml is fine. What do we do? how do we get back on track?
All the jenkins jobs are basically xml config files kept in jenkins home.
If your Jenkins is not showing these jobs then it is not using same home directory.
Kindly check jenkins process to see which directory it is pointing to.

Is this a supported Jenkins Master-slave configuration?

We have a master Jenkins running on a Linux system. The same master is attached as node using "Launch slave via execution of a command on the master". It has the same FS root as the JENKINS_HOME. The command is ssh "machine_name" "shell_script"
The shell script gets the latest slave.jar and runs it.
The master has 0 executors. The node has been given 7. I'm seeing weird behavior in the builds, like workspaces being deleted once a day, etc. I'm not sure if this is related to the way the Jenkins Master-slave is configured.
Any ideas if this is a supported configuration?

Resources