Skip to content

devops-ws/jenkins-learning-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

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.

  • The community is very active, you could ask questions from multiple channels
  • Easy installation
    • You could install Jenkins via: War package, Native package, Docker, Kubernetes, and more
  • Easy configuration
    • Almost all the configuration items have its description
  • Plugins
  • Extensible
    • It's easy to use the plugin mechanism to extend Jenkins
  • Distributed
    • Jenkins can easily distribute work across multiple machines, helping drive builds, tests and deployments across multiple platforms faster.

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:

  • Create a free-style job, generate a file then archive it.
  • Add a parameter for the job
  • Set a job watch trigger
  • Create a view

Pipeline

Task list:

  • Understand the Syntax
  • Be familiar with some important Pipeline steps
  • Build and publish a Docker image with Pipeline
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:

  • Understand the git
  • Create a GitHub multi-branch Pipeline
  • Understand some important setting items

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:

Language Link
中文 Bilibili

References

Releases

No releases published

Packages

No packages published