Detailed entry DevOps 2 --- sustainable integrated jenkins

1 --- DevOps DevOps Getting Detailed Introduction

Detailed entry DevOps 2 --- sustainable integrated jenkins

Detailed entry DevOps 3 --- container management platform Rancher

How does it achieve sustainable integration?

1 Continuous Integration

  1.1 Introduction Continuous Integration

      1.1.1 Description of the problem

      Traditional software development process is as follows:

      1, the project manager assigned to a developer module

      2, each module developer to develop in parallel, and unit test

      3, the development is completed, the code will be deployed to the test server integration, testers for testing.

      4, testers found bug, submitting bug, bug developers to modify

      5, bug again the modification is completed integration and testing.

      Problem Description:

      1, complex dependencies between the modules, found at a large number of integrated bug

      2, testers too long to wait for test

      3, software delivery can not be guaranteed

      Thinking to solve the problem:

      1. Can the integration testing ahead of time?

      2. Can I use automated tools instead of doing integration deployment process?

     1.1.2 What is Continuous Integration

      The following is a description Baidu Encyclopedia

             

       Continuous integration (Continuous integration) referred to as CI, continuous integration idea is to merge the code multiple times a day to the trunk, and integration, testing, early detection of errors so that you can, be amended. Lasting integration also belongs DevOps

      Continuous integration benefits:

      1, the deployment of integrated automation and improve the efficiency of integration;

      2, faster fix the problem;

      3, be delivered faster;

      4, improved product quality;

      5, reduce manpower deployment costs.

      1.1.3 Continuous Integration Process

      

  Please refer to himself jenkins build another article: centOS7 build jenkins, achieve maven + tomcat + vue remote server build automation

  Not covered above docker deployment vessel, and then explain in detail below under the docker integrated jenkins

    1.1.4 docker and achieve sustainable integration jenkins

    1, the new maven project

  

    2, configure git address 

 

    3, before operating configuration build maven

    Configuring remote shell command

#!/bin/bash
// 查看是否存在启动容器
result=$(docker ps | grep "live-service")
if [[ "$result" != "" ]]
then
echo "stop live-service"
// 停止容器
docker stop live-service
fi
// 查看是否存在容器
result1=$(docker ps -a | grep "live-service")
if [[ "$result1" != "" ]]
then
echo "rm live-service"
// 删除容器
docker rm live-service
fi
// 查看是否存在镜像
result2=$(docker images | grep "live-service")
if [[ "$result2" != "" ]]
then
echo "rmi ip:5000/live-service:2.0.0"
// 删除镜像
docker rmi ip:5000/live-service:2.0.0
fi

    Probably the script is to stop the flow of container vessels --- --- Delete to remove the mirror

   4, configure maven compile address, command

    5, compile, remote server, execute the script

    Configuring remote shell command 

docker run --name live-service -p 8099:8099 -d ip:5000/live-service:2.0.0
docker logs -f live-service

    Probably mirroring process is pulling from a private warehouse --- docker to create and launch container 

   6, execute the build, then return success to build success

    Enter the task page, click on the "Build Now"

    Began to build, view the log, sucess is successful

  After successfully constructed, can be seen on the mirror server starts successfully

   In addition, jenkins support automation, time to build.

Published 41 original articles · won praise 47 · views 30000 +

Guess you like

Origin blog.csdn.net/u014526891/article/details/103759526