Giter Site home page Giter Site logo

jenkins's Introduction

Description

Local Jenkins development environment based on docker.

See Docker Hub: https://hub.docker.com/r/phzfi/jenkins/
See https://github.com/jenkinsci/docker/
Built on https://hub.docker.com/r/jenkins/jenkins/

Requirements

Docker
docker-compose

Usage instructions

Create a docker-compose.yml like this:

version: '2'
services:
  jenkins:
    image: phzfi/jenkins
    ports: 
      - "8888:8080"
      - "50000:50000"
    volumes:
      - "./jenkins_home:/var/jenkins_home"
      - "./:/mnt/workspace"


Create a directory (that holds Jenkins configurations) and add it to your local .gitignore

mkdir jenkins_home

docker-compose up -d

cat jenkins_home/secrets/initialSecret

Set up a project

Pipeline

Git repository location: file:////mnt/workspace

Change the branch on Jenkins to the one you are developing currently i.e. */mybranch

Setting up JLNP Slave Node

For example for vagrant environments, you can't run them inside docker, so we need to setup
a slave executor on the host. Maybe the easiest way is to use JLNP protocol.

First add a node by go to 
Manage Jenkins->Manage Nodes->New Node
* Name: localhost
* Permanent Agent
Then
* Launch method: Launch agent via Java Web Start

You need to create a user on the host machine that has sudo rights

sudo su
useradd jenkins
usermod -g sudo jenkins
echo "jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
mkdir /home/jenkins
chown jenkins /home/jenkins
ln -s /home/phz/workspace /mnt/workspace

Then launch JLNP agent as user jenkins
su jenkins
cd ~
wget http://localhost:8888/jnlpJars/agent.jar
java -jar agent.jar -jnlpUrl http://localhost:8888/computer/localhost/slave-agent.jnlp -workDir "/home/phz/workspace/"

Build instructions

docker login --username=phzfi
docker build .
docker tag abcdef123 phzfi/jenkins"
docker push phzfi/jenkins

Things to know

Life is not easy with docker. As Jenkins checks out the version control by commits,
you need to do local commits after each change that you want to build. However, you
don't need to push the changes to origin, local commits are good enough.

jenkins's People

Contributors

pharazon avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.