Skip to content

lj020326/jenkins-docker-agent

 
 

Repository files navigation

Docker images build License

jenkins-docker-agent

The jenkins-agent enabled docker images defined here can be found on dockerhub.

Docker CICD builder agent for Jenkins.

Inspired by:

Description

It can be used as a Jenkins inbound agent, for use with Jenkins Cloud plugins.

Status

GitHub issues GitHub stars Docker Pulls - cicd-build-tools Docker Pulls - jenkins-docker-cicd-agent Docker Pulls - cicd-docker-in-docker Docker Pulls - jenkins-dind-agent Docker Pulls - jenkins-swarm-agent

How to use this Docker image

This Docker image is intended to be used in conjunction with a Docker container orchestration service such as

It can also be used as a "static" Jenkins agent connected to a Jenkins master by manually launching the Docker container.

Java

Sample with the Jenkins Pipeline Maven Plugin.

node ("cicd-docker-agent") { 

    git "https://github.com/cloudbees-community/game-of-life"
    withMaven(mavenSettingsConfig:'my-maven-settings') {
       sh "mvn clean deploy"
    }
}

Selenium

The docker image enables Selenium tests bundling Firefox and starting selenium-server-standalone (listening on the default port 4444).

Selenium Sample with Java

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

WebDriver webDriver = new RemoteWebDriver(DesiredCapabilities.firefox());
webDriver.get("http://www.python.org");
webDriver.getTitle();

Selenium Sample with Python

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
   command_executor='http://127.0.0.1:4444/wd/hub',
   desired_capabilities=DesiredCapabilities.FIREFOX)

driver.get('http://python.org')

Running

To run a Docker container

docker run cicd-docker-agent -url http://jenkins-server:port <secret> <agent name>

optional environment variables:

  • JENKINS_URL: url for the Jenkins server, can be used as a replacement to -url option, or to set alternate jenkins URL
  • JENKINS_TUNNEL: (HOST:PORT) connect to this agent host and port instead of Jenkins server, assuming this one do route TCP traffic to Jenkins master. Useful when when Jenkins runs behind a load balancer, reverse proxy, etc.

Contact

Linkedin

Packages

 
 
 

Languages

  • Python 89.1%
  • Dockerfile 6.6%
  • Shell 4.3%