Home

Awesome

Learning guide for Jenkins

Hopefully this guide could help you have a better understand of Jenkins, and even be good at it.

What is it

Before we get started, it's important to figure out what Jenkins is.

Jenkins is an open-source automation server. It's a community driven project, and belongs to the Continuous deliver Foundation (aka, CDF). But it orinally came from Sun Microsystems.

From the technical perspective, it is written by Java. There are over 1800 plugins you could find from the community. Basically you will be able to the exsiting plugin to do what everything you want.

Why do we use it

There are serval reasons that make it be worth to let you choose it.

How can we use it

Please make sure you have JRE 11 (Java Runtime Environment) or Docker. Your computer should has at least 1G memory, and 5G storage for the learing purpose.

Installation

There are four common ways to install Jenkins.

A simple command to run Jenkins from a single war file:

java -jar jenkins.war

A simiple command to run Jenkins in a container:

docker run -d -p 8080:8080 jenkins/jenkins:2.361.3-jdk11

See the official installation tutorial.

Basic usage

Task list:

Pipeline

Task list:

pipeline {
    agent {
        label 'java'
    }

    stages {
        stage ('clone') {
            checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/devops-ws/learn-pipeline-java']]])
        }
        stage ('build') {
            sh 'mvn clean package'
        }
    }
}

See the Pipeline syntax manual or the Snippet Generator.

Mutli-branch Pipeline

Task list:

Configuration as Code

TODO

See also the official document.

Run in Kubernetes

TODO

SharedLibrary

TODO

Custom package

TODO

Others

Please visit the following links if you prefer other languages:

LanguageLink
中文Bilibili

References