Skip to content

Latest commit

 

History

History
executable file
·
80 lines (56 loc) · 3.64 KB

serverless_ci.md

File metadata and controls

executable file
·
80 lines (56 loc) · 3.64 KB

Serverless CI

What is Hyper_?

Hyper_ is a container-native cloud service. Different from traditional IaaS and CaaS, Hyper_ does not employ VMs (cluster). Container is the only object the users work with. Hyper_’s secret source is its container runtime technology, which combines the VM-level isolation and the speed and immutability of container, making using and deploying containers to production as simple as using Docker on your laptop.

Why run Jenkins in Hyper_?

Jenkins is the market leader for CI/CD workloads. The two most popular plugins are currently for AWS and DigitalOcean. Jenkins Amazon EC2 Plugin allows user to provision EC2 instances as Jenkins Slave Node, while DigitalOcean Plugin allows the user to provision Droplet as Jenkins Slave Node. Both are VM focused solutions.

The Hyper_ plugin allows users to launch containers on demand in Hyper_ as Jenkins slave node. This presents a number of benefits:

  • Lower Cost: per second billing (hourly pricing in AWS and DO)
  • Faster to start: 3~10 seconds (55s in DO)
  • Compatibility: no changes to workflow TBD
  • Easy to use: Designed for Docker

Getting Started

Sign Up

You can follow the instructions to setup your account:

Deploy Jenkins Server

Firstly, we need to deploy the Jenkins server. And that only takes two commands in Hyper_:

// launch a jenkins server container
$ hyper run -d --name jenkins-server --size=m1 -P hyperhq/hyperkins

// attach a public ip to the container
$ hyper fip attach $(hyper fip allocate 1) jenkins-server

Configure Jenkins

Once the server is launched, it generates a random initial password for the Jenkins admin account. To find out the password, run:

$ hyper exec -it jenkins-server cat /var/jenkins_home/secrets/initialAdminPassword

Then open the Jenkins web portal in the browser to access Jenkins Master Web UI, enter the initial password to unlock the system:

Next, let's configure the Hyper_ credential to allow Jenkins to launch slave containers:

  • Login the web portal;
  • goto menu Manage Jenkins -> Configure System
  • Enter Hyper_ Access Key and Secret Key
  • Click Save credential
  • Click Test connection to Hyper_

Also, Jenkins server need to pass its URL to the slave containers, in order for the slave containers to connect. To find out the public IP of the Jenkins server:

$ hyper inspect --format '{{.NetworkSettings.IPAddress}}' jenkins-server
172.16.1.200
  • Login the web portal
  • goto menu Manage Jenkins -> Configure System -> Jenkins Location
  • Jenkins URL: http://172.16.1.200:8080/

Enable JNLP

  • (Menu)Manage Jenkins
  • Configure Global Security:

Submit Jobs

Check “Run the build inside Hyper_ Container”

Run Jenkins Job in Hyper_ Slave

That’s all.