<> use Docker install GitLab and Jenkins

<> Download and install gitlab image
# download gitlab Image file $ docker pull gitlab/gitlab-ce:latest # start-up gitlab $ docker run
-d \ --hostname HOST_NAME \ -p 9443:443 -p 9080:80 -p 2222:22 \ --name gitlab \
-v PATH/config:/etc/gitlab \ -v PATH/logs:/var/log/gitlab \ -v
PATH/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest # modify PATH/config/gitlab.rb $
cat PATH/config/gitlab.rb gitlab_rails['gitlab_shell_ssh_port'] = 2222 #
restart gitlab container $ docker stop gitlab $ docker rm gitlab $ docker run -d \ --hostname
HOST_NAME \ -p 9443:443 -p 9080:80 -p 2222:22 \ --name gitlab \ -v
PATH/config:/etc/gitlab \ -v PATH/logs:/var/log/gitlab \ -v
PATH/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest
<> Download and install Jenkins
# download jenkins image $ docker pull jenkins # start-up jenkins $ docker run -d \ -p 8080:8080
\ -p 50000:50000 \ -v PATH/jenkins-data:/var/jenkins_home \ -v
/var/run/docker.sock:/var/run/docker.sock \ --name jenkins \ jenkins:latest
<>Jenkins security setting
1. click “ system management ” - get into “ Global security configuration ” 2. stay “ access control ”-“ Authorization strategy ”-“ Login users can do anything ” Middle check “ Anonymous users have read access ” 3.
Remove "CSRF Protection" Medium " Prevent cross Site Request Forgery "

<>gitlab add to jenkins Server and git The server SSH KEYS

<>jenkins Create pipeline task

<>jenkins Trigger remote build

<>gitlab add to jenkins hook

<>jenkins Write pipeline script
# Build pipeline script #!groovy pipeline { agent any environment {
REPOSITORY="ssh://git@gitlab.hadeian.com:2222/hadeian/microservice.git"
MODULE="user-edge-service" SCRIPT_PATH="~/scripts" } stages { stage(' Get code ') {
steps { echo "start fetch from git:${REPOSITORY}" deleteDir() git
"${REPOSITORY}" } } stage(' compile + unit testing ') { steps { echo "start compile" sh "mvn -U
-pl ${MODULE} -am clean package" } } stage(' Building a mirror image ') { steps { echo "start build
image" sh "${SCRIPT_PATH}/build-image.sh ${MODULE}" } } stage(' Publishing services ') { steps {
echo "start deploy" sh "${SCRIPT_PATH}/deploy.sh user-edge-service ${MODULE}" }
} } } # Remote execution of compilation scripts $ cat build-image.sh #!/bin/bash MODULE=$1 TIME=`date
"+%Y%m%d%H%M"` GIT_VERSION=`git log -1 --pretty=format:"%h"`
IMAGE_NAME=DOCKER_REGISTRY/PRODUCT_NAME/${MODULE}:${TIME}_${GIT_VERSION} cd
${MODULE} docker build -t ${IMAGE_NAME} . cd - docker push ${IMAGE_NAME} echo
"${IMAGE_NAME}" > IMAGE_NAME # to write K8S Update service script $ cat deploy.sh #!/bin/bash
IMAGE=`cat IMAGE_NAME` DEPLOYMENT=$1 MODULE=$2 kubectl set image
deployment/${DEPLOYMENT} ${MODULE}=${IMAGE}

Technology
©2019-2020 Toolsou All rights reserved,
be based on STM32 Design of infrared obstacle avoidance car ( There is a code )LED Scrolling text ( Essence )2020 year 7 month 21 day ASP.NET Core Use of global filters PHP Printout logpython in switch_to_alert Usage of Shortest path Dijkstra (Python3)elementui select obtain value( Essence )2020 year 6 month 26 day C# Class library model PageInput( Essence )2020 year 6 month 26 day C# Class library read json Profile help class MySql sentence Recursively find all subordinate departments of an input department