Jenkins through docker: How to configure own host as agent for jenkins? - macos

I'm using Jenkins with pipelines on a mac-mini. All builds are working fine with docker agents (backend, frontend, android app, etc)
The only thing I haven't been able to achieve is to use my own mac-mini as build-agent/slave for the IOS app (I need to build on OSX). Jenkins itself runs through docker as well, so I would need to connect to the host (the OS of the mac-mini) and use that as an agent...
I know one option would be to install jenkins instead of using docker, but I would prefer to keep Jenkins running in a docker container.
Does someone has experience with this or knows any good documentation on how to set this up?

Go to Manage Jenkins > Manage Nodes > New Node.
Configure a node.
Go to the list of nodes.
Select your newly configured node. It should be offline at this moment.
Run the java command displayed on the interface on your host machine.
Your Host machine is now a slave.

Related

GitLab runner using more recent release of Node than installed on server

I currently have a Windows GitLab runner installed on a Windows server with Node v15.14.0 installed, but when I attempt to run the single job in my pipeline, it appears to run with Node v17.4.0.
What might be the cause for the discrepancy?
Screenshot of the Node version
My best guess is that the GitLab Runner host machine has multiple versions of Node installed.
I would recommend creating another GitLab Runner using the Docker executor, instead of the Shell executor, and specify an appropriate docker image (e.g. - node:15.14.0) to use for the job.

drone.io how to run command on local server

I have drone installed on a Mac mini as a CI/CD for Android and iOS apps. To build for iOS I need to run commands on the server itself. I know there is a ssh plugin, but is there another way to run commands on the host from a drone pipeline step?
I would suggest taking a look at the exec runner, sounds like exactly what you would need.
The Exec runner executes build pipelines directly on the host machine without isolation, using the default shell. This runner is not suitable for un-trusted workloads for security reasons.
https://exec-runner.docs.drone.io/

Test run on Jenkins Nodes using SSH agent is not showing GUI

I have used cloud bees Jenkins account to setup my build to run on a Jenkins Node machine which is an AWS system(Windows Server 2016). I have setup SSH(port 22) on AWS system using CYGWIN, configured and launched agent on this machine using following launch method:
Now my tests are running on the Jenkins Node (AWS Machine) but I am not able to see the GUI for it. Please let me know what setting I need to enable to make it visible? also let me know if more details are required.

Using a Windows VM from Jenkins through vsphere

I'm trying to reset-and-launch a Windows VM (in vsphere) during a Jenkins job. I successfully installed the vSphere Cloud Plugin. I've followed instructions to setup the Windows machine as a jenkins-mvn-slave, and have it setup to run as a service.
If I click on the button in Jenkins for Launch Slave Agent, I can see (in vsphere) that the VM does a revert snapshot, and then it does a power on virtual machine. If I attach to the machine, I can see that the Jenkins service starts automatically. However, back in Jenkins, it tells me that the Slave did not come online in allowed time.
Some key settings for my slave:
Force VM launch: Checked
Wait for VMTools: Not checked
Delay between launch and boot complete: 120
Secondary launch method: Launch slave agents view Java Web Start
Versions:
Jenkins: 1.596.2
vSphere: 5.5.0
Windows: Server 2012 R2 Standard, Build 9600
vSphere plugin: 2.7
What am I missing?
I've done a lot of messing around since I posted, but I think the following is what I was doing wrong. I first got the VM working as a normal slave agent. Once I had that working, then I tried to setup the same as a vsphere-cloud-slave-agent. I wasn't realizing that setting up a host as a slave agent is "agent-name specific".
So, I uninstalled the Jenkins service, launched the "vsphere cloud slave agent", logged into the machine, and ran javaws (as specified in the previously mentioned instructions.
A couple of other gotchas that I encountered (not relevant to the initial post, but maybe relevant to someone who reads this):
I originally installed git with a password manager. Unfortunately, since jenkins jobs aren't interactive, it was hanging on the git clone command. I tried uninstalling and re-installing git, but it didn't fix the problem for whatever user the jenkins slave was running as. I ended up having to revert to a previous slave image and install git from there. (I probably could have also figured out what user was running the jenkins slave, and entered the desired password there.)
I wanted to run a clean VM for each job. I never figured out this one. If I set Availability to Take this slave on-line when in demand and off-line when idle, that was a good start. However, if I set the times to 0 and 0, then the machine was constantly rebooting. If I set the times to 1 and 1, then the machine does mostly what I want, unless there are back-to-back jobs queued to run.

CentOS 6.4 Minimal + how to configure jenkins jobs via xml?

I need to create a Build Server in CentOS 6.4 Minimal I sucessfully installed:
Java compiler (OpenJDK 1.7.0)
Git or Mercurial
Maven
Jenkins
Now I need to to the following:
At given intervals (eg daily at midnight) is the latest revision in the version control system (tip, HEAD, ...) compiled with Maven. In addition, Java Docs and packages (jar, war) need to be created.
Then Jenkins with all tests conducted and reported.
Make sure there is a report of previous builds
Ensure that the Java Docs and packages can be downloaded (jars, wars, ...) of the latest build
I can't use a GUI on CentOS Minimal so I need to configure the job in xml files? Could please someone show me the way... I'm not a linux server guru.
It's a bit impractical to configure Jenkins via XML by hand, because Jenkins' configuration is spread over multiple files, and the format of the configuration files changes between releases.
Given that Jenkins is a web application, you should be able to visit port 8080 (Jenkins' default port, assuming you didn't change it) on the server where you installed Jenkins (e.g. http://mycentosserver.example.com:8080), and configure it via the web interface.
If you're unable to access the web interface because of a firewall or similar, but you are able to SSH to the server (presumably you can, given that you were able to install stuff on it), you could set up an SSH tunnel to forward a port on your local machine to port 8080 on the server. For example, from your local machine, run the following command. You will then be able to access Jenkins on your local machine at http://localhost:28080 . If you're on Windows, you can use Putty to do the same thing.
ssh -L 28080:127.0.0.1:8080 mycentosserver.example.com
If you can't access the web app directly, and you can't SSH tunnel, I'd recommend setting up Jenkins on a server where you can access the web app, configuring it, and copying the XML config files from /var/lib/jenkins on that server across to your Centos server.

Resources