The initial use jenkins

The initial use jenkins

[A] Introduction

Jenkins is an open source, providing continuous integration-friendly operator interface (CI) tools, originated in Hudson (Hudson is commercially available), mainly used for continuous, automated build / test software project, monitor the operation of external tasks (this abstract and let us write, no explanation). Jenkins written in the Java language, runs Tomcat and other popular servlet container can also be run independently. Usually with version management tool (SCM), building tools in combination. Commonly used version control tools SVN, GIT, build tools Maven, Ant, Gradle.

[Two] Installation

2.1 docker install jenkins

https://blog.csdn.net/wenge1477/article/details/103828680

2.2 tomcat跑jenkins

2.3 jar packet format run jenkins

[Three] integration gitlab

3.1 gitlab New Project

Here Insert Picture Description

3.2 gitlab generation Tokens

Here Insert Picture Description
Tokens are generated for use jenkins, jenkins gitlab to call the api, authentication is required

Add Project on 3.3 jenkins

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

3.4 jenkins configuration items

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

pipeline {
   agent any

   stages {
      stage('pull code') {
         steps {
            echo 'pull code'
            git branch: 'develop', credentialsId: '47.100.21.42', url: 'http://git.xhrtas.com/fengsri/cloud-eureka-server.git'
            sh 'chmod 777 /var/jenkins_home/workspace/eureka-server-pipeline/build.sh'
            sh 'chmod 777 /var/jenkins_home/workspace/eureka-server-pipeline/run.sh'
         }
      }
      stage('build code') {
         steps {
            echo 'build code'
            sh '/var/jenkins_home/workspace/eureka-server-pipeline/build.sh'
         }
      }
      stage('unit test') {
         steps {
            echo 'unit test'
         }
      }
      stage('deploy code') {
         steps {
            echo 'deploy code'
            sh '/var/jenkins_home/workspace/eureka-server-pipeline/run.sh'
         }
      }
   }
}

Here Insert Picture Description

3.5 gitlab configuration webhook

Here Insert Picture Description
Here Insert Picture Description

3.6 Test

As long as I am every merge onto the master, went back to the trigger webhook jenkins, jenkins will go pull the code on gitlab, automated build, test, release code
Here Insert Picture Description

[Four] link

Published 130 original articles · won praise 88 · views 20000 +

Guess you like

Origin blog.csdn.net/wenge1477/article/details/103882809