The Serverless Jenkins Distro
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
groovy
images
script
.gitignore
Dockerfile [enable-csrf-protection] enable csrf protection Nov 22, 2018
Dockerfile.template
README.md
util.sh

README.md

Hykins User Guide

Hykins is a serverless Jenkins distro optimized for containers. Currently, Hykins supports Hyper.sh as infrastructure provider, with more to be added easily.

Quickstart

Setup

First, you need to setup your account on Hyper.sh:

Deploy Hykins container

There is a prebaked Docker image for Hykins available in Docker Hub. You can simply pull the image to your Hyper.sh account:

$ hyper pull hyperhq/hykins

What's in the image? hyperhq/hykins is based on jenkins:latest, with the following items installed:

  • hyper command line tools
  • hyper-slaves-plugin for Jenkins
  • Recommended plugins by Jenkins community

You can find the Dockerfile here.

To deploy Hykins in Hyper.sh:

$ hyper run --name hykins -d -P \
  --size=m1 \
  -e ADMIN_USERNAME=xxxxx \
  -e ADMIN_PASSWORD=xxxxx \
  -e ACCESS_KEY=xxxxx \
  -e SECRET_KEY=xxxxx \
  hyperhq/hykins

Notes:

  • By default, Hykins is launched in development mode(the Setup Wizard will not appear). See below to see how to run Hykins in production mode
  • In development mode, the recommended container size is m1 (1GB)
  • ADMIN_USERNAME/ ADMIN_PASSWORD is for the Hykins admin account (default: admin/nimda)
  • ACCESS_KEY/ SECRET_KEY is the API credential of Hyper.sh

Containers in Hyper.sh come without public IP address by default. To enable Internet access, you need to request one and attach to the container:

$ FIP=`hyper fip allocate 1`
$ hyper fip attach $FIP hykins

Production setup

Launch in production mode

To run Hykins in production mode, use the following command:

$ hyper run --name hykins -d -P --size=m2 -e PRODUCTION=true \
  -v hykins-data:/var/jenkins_home \
  -e ACCESS_KEY=xxxxx -e SECRET_KEY=xxxx hyperhq/hykins
$ FIP=`hyper fip allocate 1`
$ hyper fip attach $FIP hykins

Notes:

  • The recommended container size is m2(2GB memory)

Unlock Jenkins

In Production Mode, you need to unlock Jenkins to be able to access:

  • Open the web portal in your browser http://${FIP}:8080
  • Setup Wizard will prompt to ask for initial admin password
  • run hyper exec -it hykins cat /var/jenkins_home/secrets/initialAdminPassword

Try A Sample Job

create helloworld job

//Step 1: create "Freestyle project" helloworld

//Step 2: check "Run the build inside Hyper.sh container"
   - Docker Image: jenkinsci/slave
   - Container Size: S4

Other tested base images are:

//Step 3: Add build step "Execute shell"
  - Command:

Here is the shell script:

set +x
echo ------------------------------------------------
cat /etc/os-release
echo ------------------------------------------------
cat /proc/cpuinfo | grep -E '(processor|model name|cpu cores)'
echo ------------------------------------------------
cat /proc/meminfo | grep ^Mem
echo ------------------------------------------------

trigger build

Trigger build manually in this demo.

view result

console output

Slave container info

Slave container log

Update

2018/11/22

2017/01/11

  • update jenkins from 2.19.3 to 2.19.4
  • update hyper-slaves-plugin to 0.1.6(retry when download slave.jar failed)

2016/11/17

  • update jenkins from 2.7.4 to 2.19.3
  • update hyper-slaves-plugin to 0.1.5(rely on docker-slaves-plugin)