Jenkins+GitLab+Docker持续集成LNMP(中)

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: Jenkins+GitLab+Docker持续集成LNMP(中)

(5)升级jenkins(可以不升级)

[root@jenkins ~]# cd /usr/lib/jenkins/
[root@jenkins jenkins]# ll
总用量 64688
-rw-r--r-- 1 root root 66239216 5月  28 2020 jenkins.war
[root@jenkins jenkins]# mv jenkins.war jenkins.war.bak  #把原来的包备份
[root@jenkins jenkins]# rz
z waiting to receive.**B0100000023be50
[root@jenkins jenkins]# ll
总用量 133996
-rw-r--r-- 1 root root 70969355 11月 30 2020 jenkins.war    #上传新的war包
-rw-r--r-- 1 root root 66239216 5月  28 2020 jenkins.war.bak
[root@jenkins jenkins]# systemctl restart jenkins     #重启jenkins

重新使用浏览器访问jenkins


07c1863d20904c02869c770356cc83c7.png

9052b92f21ff43ddba75aefbce084437.png

(6)修改jenkins插件下载地址

403367eef87c43f68e9167985b7e4d80.png


a9ef346eb53744a4a756b402b592e002.png

482949705e9941fbab287acce4092e0b.png


修改为http://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

进入命令行修改配置文件重启jenkins
[root@jenkins ~]# cd /var/lib/jenkins/updates/
[root@jenkins updates]# sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json && sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
[root@jenkins updates]# systemctl restart jenkins
[root@jenkins updates]# cd

74f6d95436c84b7a8879ff3c8570c15e.png

c8a295656b1b4da0b658ffc58ad3b594.png


点击这个可以下载,但是如果下载无法成功的话,可以直接替换/var/lib/jenkins下的plugins插件包目录,然后重启即可,我这里直接俄上传替换了


这里上传后因为插件包的原因还变成了中文

7d4377403a874f1c9fc2c7b6642daaf5.png

至此成功搭建Jenkins


(7)上传自己root账户的私钥到jenkins上

[root@jenkins ~]# cat .ssh/id_rsa  #复制私钥
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEApXNm9MqC/IuDtk0zvp/cNBLJUN0uXpHmpRHjEZ2MW1iA6lvn
eF90j9h2nCVpZA5e7p1TXoM0661688uFFlNaoAyPAvveMlaig9sxdDzGTzvHuTkQ
+Te4MuQiIxLqW1hwNl4Ox5fFV9YffVWXKBEZNZpwLZ2bUmchbXRm4PELF+T81vpr
x1sL4pVyaV0B13lR5TwExnDm7FTOb5CsR2o22KtS2bWEQOdSdo5CnlKj6IapmGWf
q3vTF4VSZe7i/jYLrcTfi3MKXrB+xK+4RfolA+iVawSlux5JmR2WaSJZQDECO2mv
Z6jlhpFyCq9Y0w7okCDfmpDxn1BG1neXccgt+wIDAQABAoIBAEj7X+YJUsBuFlqb
MYEb6Tm7M7yM5IBo4ZHdEwnZMmm036EBi1ho2vT86k00n4m4YR3mnjjprbVsX/kc
xIc1m5tQDuGlEr2nw6ZgUS9SA7Q9zXsh9h/I+WLRiVFpbaF/oHgLA3/9rdpyJI/X
6oaNDE694k/s3u/5eCBdIWiGS3ttHHyqe3xRPRb3yLWmqb+a0uEeOFIVkfTAmMyv
GHpBuR9ohjPoKB/Ii/gVMIDVr0JJSMAjGdfdc8w2s2lrSg+3OhGyeAe8gDdgWMGg
rhj8h0RnjyxjhTYV76BYVlmi3mnSLSqZ1rUWn9+8BrYo0LGgZFBdSrBYmKFOTeJP
J3bHzXECgYEA1bkQmXE0lko7WC/elXtmCuiKUCdyuBD4rGLeClDVhdLLpG7dgRs+
tGngSeC4EAOqsPKIGKgPQn9Yn//KRTiAaVsACFagE2/JNA1fD/OlrPgO4Tz8or7l
GW9BOf+Tg8FL1Z/abD5+Y6zK5O/pG7CgmQp0LnFGEjKT5bRXKh3QnXMCgYEAxi3V
6dTkClrO6F1vO5c7pQgbnKfd8LT+V0JRaHiTcITsyCf2/zmGMJv3i7aLX0jSoOe3
GGIsiNuYUc2zTrqsVDg3OllrK9GPhmtSv/NgiVvwoBHY7B2Ersi1dAMbsipdjedT
fqSbZVeRKsOWq0YSsYbY06W3gHgtdft2uYUsi1kCgYEAmVtML+5tX5Iwdx0SSIzd
MeKerNlBlhaHeZsP3LMYJAiYG4t54dRc8DQwvpJDQSqAZqwBQEAHgx3ByD1RNM5Q
RkkIAvO1tXy3EWSu29FnBnCQrMqINXdpCREt6qIbhaVD9yvXHWjSZE9u30vPJxFc
i7RWnaSmNRSZz2/SQ+RU90UCgYBJufGTzSSNCZ1h6qif9bI1wh9rlzPFAcCBO+XH
RNwtBvaDvAJyjrbyTIO6UU3mQ9RAEhQWmSdSPsea3ziuuFm19zfsmCl7ormPW0vs
pyEp2K9bDWiy5oRe9cIzh5h9Hq+xQ/bW7Wv2Nq6Fxz+9NhNsQetWSZdLzumys7tG
Z1nb+QKBgCIgZ0bPnRl8Tv3KwCqYn5OAK0jnxwRU5LPkHKSr/3zLIPIALHHCSpgL
zep1WzlWb/FEsdb3xHD/n+MqHcGxLzly+OA3NAqr675aQC/qSQtqEPPL6LTawuOz
EkZzROrU03xGPRl0nJ1ikoqYfw9+pAm9fiH28BWWdWSOG4cBmIXU
-----END RSA PRIVATE KEY-----

7ed23caa44ed41acadefc274c93c8bf5.pngc2fea3f52d324349bf7cc81a8c017a9e.png

27cfb97562d74098b590484f8e8e3efc.png

4fae7e815374403e90c6153048b51fc4.png

249184055e60436e89e35e728b61b8fc.png

(8)把Jenkins密钥传到其他主机上

在上面的gitlab生成ssh密钥已经生成过了,所以这里直接传就行
[root@jenkins ~]# ssh-copy-id root@192.168.100.202
[root@jenkins ~]# ssh-copy-id root@192.168.100.203
[root@jenkins ~]# ssh-copy-id root@192.168.100.204
[root@jenkins ~]# ssh-copy-id root@192.168.100.205
[root@jenkins ~]# ssh-copy-id root@192.168.100.206

(3)搭建Harbor仓库,上传镜像

******(1)先做基础配置
[root@Centos7 ~]# hostnamectl set-hostname harbor
[root@Centos7 ~]# su
[root@harbor ~]# systemctl stop firewalld
[root@harbor ~]# setenforce 0
setenforce: SELinux is disabled
[root@harbor ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
mount: /dev/sr0 已经挂载或 /mnt 忙
       /dev/sr0 已经挂载到 /mnt 上
******(2)安装docker
[root@harbor ~]# yum install -y yum-utils device-mapper-persistent-data lvm2  #安装依赖
。。。。。。
完毕!
[root@harbor ~]# ll
总用量 8
-rw-------. 1 root root 1264 1月  12 2021 anaconda-ks.cfg
drwxr-xr-x  3 root root 4096 8月   1 22:48 docker
[root@harbor ~]# vim /etc/yum.repos.d/centos.repo 
[aaa]
name=aaa
baseurl=file:///mnt
enabled=1
gpgcheck=0
[docker]
name=docker
baseurl=file:///root/docker
enabled=1
gpgcheck=0
#保存退出
[root@harbor ~]# yum -y install docker-ce
。。。。。。
#保存退出
[root@harbor ~]# mkdir -p /etc/docker/
[root@harbor ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://w4uieobw.mirror.aliyuncs.com"],
  "insecure-registries": ["192.168.100.206"]
}
#保存退出
******(3)安装Harbor,这里只搭建http协议的harbor
[root@harbor ~]# ll
总用量 614824
-rw-------. 1 root root      1264 1月  12 2021 anaconda-ks.cfg
drwxr-xr-x  3 root root      4096 8月   1 22:48 docker
-rw-r--r--  1 root root 629571428 8月   1 22:52 harbor-offline-installer-v2.3.1.tgz  #上传安装包
[root@harbor ~]# tar xf harbor-offline-installer-v2.3.1.tgz -C /usr/local/
[root@harbor ~]# cd /usr/bin   
[root@harbor bin]# rz
z waiting to receive.**B0100000023be50
[root@harbor bin]# chmod  a+x docker-compose 
[root@harbor bin]# ll | grep docker-compose
-rwxr-xr-x    1 root root    11748168 7月  28 18:54 docker-compose
[root@harbor bin]# cd
[root@harbor ~]# vim /usr/local/harbor/harbor.yml.tmpl
  1 # Configuration file of Harbor
  2 
  3 # The IP address or hostname to access admin UI and registry service.
  4 # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
  5 hostname: 192.168.100.206
  6 
  7 # http related config
  8 http:
  9   # port for http, default is 80. If https enabled, this port will redirect to https port
 10   port: 80
 11 
 12 # https related config
 13 #https:
 14   # https port for harbor, default is 443
 15   #port: 443
 16   # The path of cert and key files for nginx
 17   #certificate: /your/certificate/path
 18   #private_key: /your/private/key/path
 19 
。。。。。。
#保存退出
[root@harbor ~]# cd /usr/local/harbor/
[root@harbor harbor]# cp harbor.yml.tmpl harbor.yml
[root@harbor harbor]# systemctl start docker   #启动docker
[root@harbor harbor]# sh install.sh #安装harbor,第一次使用脚本安装后续可使用“docker-compose up -d”命令启动 Harbor,使用“docker-compose stop”命令关闭 Harbor
[root@harbor harbor]# echo $?
0
[root@harbor harbor]# ps aux | grep docker-compose  #成功开启
root      16980  0.0  0.0 112676   988 pts/0    R+   23:00   0:00 grep --color=auto docker-compose
[root@harbor harbor]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
goharbor/harbor-exporter        v2.3.1              719fd825651e        13 days ago         81MB
goharbor/chartmuseum-photon     v2.3.1              3aba4510af16        13 days ago         178MB
goharbor/redis-photon           v2.3.1              4a0d49a4ece0        13 days ago         191MB
goharbor/trivy-adapter-photon   v2.3.1              a285847f857a        13 days ago         164MB
goharbor/notary-server-photon   v2.3.1              87a2dbfd122e        13 days ago         110MB
goharbor/notary-signer-photon   v2.3.1              7e29ff33ec85        13 days ago         107MB
goharbor/harbor-registryctl     v2.3.1              91e798004920        13 days ago         132MB
goharbor/registry-photon        v2.3.1              972ce19b1882        13 days ago         81.2MB
goharbor/nginx-photon           v2.3.1              3b3ede1db494        13 days ago         44.3MB
goharbor/harbor-log             v2.3.1              40a54594fe22        13 days ago         194MB
goharbor/harbor-jobservice      v2.3.1              d6e174ae0a00        13 days ago         171MB
goharbor/harbor-core            v2.3.1              f05acc3947d6        13 days ago         158MB
goharbor/harbor-portal          v2.3.1              4a15c5622fda        13 days ago         57.6MB
goharbor/harbor-db              v2.3.1              b16a9c81ef03        13 days ago         263MB
goharbor/prepare                v2.3.1              4ce629d59c20        13 days ago         288MB
[root@harbor harbor]# docker ps
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS                    PORTS                       NAMES
5bf08af481aa        goharbor/harbor-jobservice:v2.3.1    "/harbor/entrypoint.…"   34 seconds ago      Up 30 seconds (healthy)                               harbor-jobservice
d38b62be5d2b        goharbor/nginx-photon:v2.3.1         "nginx -g 'daemon of…"   34 seconds ago      Up 30 seconds (healthy)   0.0.0.0:80->8080/tcp        nginx
3d223a63d976        goharbor/harbor-core:v2.3.1          "/harbor/entrypoint.…"   37 seconds ago      Up 33 seconds (healthy)                               harbor-core
964e5805fb81        goharbor/harbor-portal:v2.3.1        "nginx -g 'daemon of…"   39 seconds ago      Up 36 seconds (healthy)                               harbor-portal
41038ff6f31e        goharbor/harbor-db:v2.3.1            "/docker-entrypoint.…"   39 seconds ago      Up 36 seconds (healthy)                               harbor-db
6b3503d1367e        goharbor/redis-photon:v2.3.1         "redis-server /etc/r…"   39 seconds ago      Up 36 seconds (healthy)                               redis
c059529f89f3        goharbor/harbor-registryctl:v2.3.1   "/home/harbor/start.…"   39 seconds ago      Up 36 seconds (healthy)                               registryctl
55a65d22d7b3        goharbor/registry-photon:v2.3.1      "/home/harbor/entryp…"   39 seconds ago      Up 36 seconds (healthy)                               registry
73f8185a516a        goharbor/harbor-log:v2.3.1           "/bin/sh -c /usr/loc…"   41 seconds ago      Up 39 seconds (healthy)   127.0.0.1:1514->10514/tcp   harbor-log
[root@harbor harbor]# cd

(4)使用浏览器访问harbor


96e0e71545644f6391dc431cf7ba5996.png

记住这个项目


2ccf4766f46c4f659e333ca8a07d11de.png

******(5)上传镜像,修改tag推送到镜像仓库
[root@harbor ~]# ll
总用量 2320516
-rw-------. 1 root root       1264 1月  12 2021 anaconda-ks.cfg
drwxr-xr-x  3 root root       4096 8月   1 22:48 docker
-rw-r--r--  1 root root  629571428 8月   1 22:52 harbor-offline-installer-v2.3.1.tgz
-rw-r--r--  1 root root  453615616 8月   1 23:04 mysql_5.7.tar.gz
-rw-r--r--  1 root root  137441280 8月   1 23:04 nginx
-rw-r--r--  1 root root 1155569664 8月   1 23:05 php_5.6
[root@harbor ~]# docker load -i nginx 
[root@harbor ~]# docker load -i php_5.6 
[root@harbor ~]# docker load -i mysql_5.7.tar.gz 
[root@harbor ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
mysql                           5.7                 8cf625070931        10 days ago         448MB
goharbor/harbor-exporter        v2.3.1              719fd825651e        13 days ago         81MB
goharbor/chartmuseum-photon     v2.3.1              3aba4510af16        13 days ago         178MB
goharbor/redis-photon           v2.3.1              4a0d49a4ece0        13 days ago         191MB
goharbor/trivy-adapter-photon   v2.3.1              a285847f857a        13 days ago         164MB
goharbor/notary-server-photon   v2.3.1              87a2dbfd122e        13 days ago         110MB
goharbor/notary-signer-photon   v2.3.1              7e29ff33ec85        13 days ago         107MB
goharbor/harbor-registryctl     v2.3.1              91e798004920        13 days ago         132MB
goharbor/registry-photon        v2.3.1              972ce19b1882        13 days ago         81.2MB
goharbor/nginx-photon           v2.3.1              3b3ede1db494        13 days ago         44.3MB
goharbor/harbor-log             v2.3.1              40a54594fe22        13 days ago         194MB
goharbor/harbor-jobservice      v2.3.1              d6e174ae0a00        13 days ago         171MB
goharbor/harbor-core            v2.3.1              f05acc3947d6        13 days ago         158MB
goharbor/harbor-portal          v2.3.1              4a15c5622fda        13 days ago         57.6MB
goharbor/harbor-db              v2.3.1              b16a9c81ef03        13 days ago         263MB
goharbor/prepare                v2.3.1              4ce629d59c20        13 days ago         288MB
nginx                           latest              4cdc5dd7eaad        3 weeks ago         133MB
cytopia/php-fpm-5.6             latest              2943ebf1ef81        3 years ago         1.1GB
[root@harbor ~]# docker tag mysql:5.7 192.168.100.206/library/mysql:5.7
[root@harbor ~]# docker tag nginx:latest 192.168.100.206/library/nginx:latest
[root@harbor ~]# docker tag cytopia/php-fpm-5.6:latest 192.168.100.206/library/php:latest
[root@harbor ~]# docker login -u admin -p Harbor12345 192.168.100.206
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@harbor ~]# docker push 192.168.100.206/library/mysql:5.7
[root@harbor ~]# docker push 192.168.100.206/library/nginx:latest
[root@harbor ~]# docker push 192.168.100.206/library/php:latest


在浏览器查看

532d1beadd5645088a8df53a515279af.png


至此Harbor仓库搭建完成,镜像上传完成


(4)在测试环境、生产环境上安装Docker,从harbor镜像仓库拉取镜像

******(1)先做基础配置,两台主机配置相同
[root@Centos7 ~]# hostnamectl set-hostname test
[root@Centos7 ~]# su
[root@test ~]# systemctl stop firewalld
[root@test ~]# setenforce 0
setenforce: SELinux is disabled
[root@test ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
mount: /dev/sr0 已经挂载或 /mnt 忙
       /dev/sr0 已经挂载到 /mnt 上
[root@Centos7 ~]# hostnamectl set-hostname true
[root@Centos7 ~]# su
[root@true ~]# systemctl stop firewalld
[root@true ~]# setenforce 0
setenforce: SELinux is disabled
[root@true ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 写保护,将以只读方式挂载
mount: /dev/sr0 已经挂载或 /mnt 忙
       /dev/sr0 已经挂载到 /mnt 上
******(2)安装Docker,上传docker-compose
[root@test ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@test ~]# vim /etc/yum.repos.d/centos.repo 
[aaa]
name=aaa
baseurl=file:///mnt
enabled=1
gpgcheck=0
[docker]
name=docker
baseurl=file:///root/docker
enabled=1
gpgcheck=0
#保存退出
[root@test ~]# ll
总用量 8
-rw-------. 1 root root 1264 1月  12 2021 anaconda-ks.cfg
drwxr-xr-x  3 root root 4096 8月   2 00:05 docker
[root@test ~]# yum -y install docker-ce
[root@test ~]# cd /usr/bin/
[root@test bin]# rz
z waiting to receive.**B0100000023be50
[root@test bin]# ll | grep docker-compose
-rw-r--r--    1 root root    11748168 7月  28 18:54 docker-compose
[root@test bin]# chmod a+x docker-compose 
[root@test bin]# cd
[root@test ~]# mkdir /etc/docker
[root@test ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://w4uieobw.mirror.aliyuncs.com"],
  "insecure-registries": ["192.168.100.206"]
}
#保存退出
[root@test ~]# systemctl start docker
[root@test ~]# docker login -u admin -p Harbor12345 192.168.100.206
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@test ~]# docker pull 192.168.100.206/library/nginx:latest
[root@test ~]# docker pull 192.168.100.206/library/php:latest
[root@test ~]# docker pull 192.168.100.206/library/mysql:5.7
[root@test ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
192.168.100.206/library/mysql   5.7                 8cf625070931        10 days ago         448MB
192.168.100.206/library/nginx   latest              4cdc5dd7eaad        3 weeks ago         133MB
192.168.100.206/library/php     latest              2943ebf1ef81        3 years ago         1.1GB
[root@true ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
[root@true ~]# vim /etc/yum.repos.d/centos.repo 
[aaa]
name=aaa
baseurl=file:///mnt
enabled=1
gpgcheck=0
[docker]
name=docker
baseurl=file:///root/docker
enabled=1
gpgcheck=0
#保存退出
[root@true ~]# ll
总用量 8
-rw-------. 1 root root 1264 1月  12 2021 anaconda-ks.cfg
drwxr-xr-x  3 root root 4096 8月   2 00:06 docker
[root@true ~]# yum -y install docker-ce
[root@true ~]# cd /usr/bin/
[root@true bin]# rz
z waiting to receive.**B0100000023be50
[root@true bin]# ll | grep docker-compose
-rw-r--r--    1 root root    11748168 7月  28 18:54 docker-compose
[root@true bin]# chmod a+x docker-compose 
[root@true bin]# cd
[root@true ~]# mkdir /etc/docker
[root@true ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://w4uieobw.mirror.aliyuncs.com"],
  "insecure-registries": ["192.168.100.206"]
}
#保存退出
[root@true ~]# systemctl start docker
[root@true ~]# docker login -u admin -p Harbor12345 192.168.100.206
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
[root@true ~]# docker pull 192.168.100.206/library/nginx:latest
[root@true ~]# docker pull 192.168.100.206/library/php:latest
[root@true ~]# docker pull 192.168.100.206/library/mysql:5.7
[root@true ~]# docker images
REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
192.168.100.206/library/mysql   5.7                 8cf625070931        10 days ago         448MB
192.168.100.206/library/nginx   latest              4cdc5dd7eaad        3 weeks ago         133MB
192.168.100.206/library/php     latest              2943ebf1ef81        3 years ago         1.1GB

(5)使用jenkins登录gitlab复制仓库,然后把compose-lnmp传到仓库

7eeaf89acecf40dcb7eae3669439b287.png


[root@jenkins ~]# git config --global user.name "Administrator"
[root@jenkins ~]# git config --global user.email "admin@example.com"
[root@jenkins ~]# git clone git@192.168.100.202:root/lnmp.git
正克隆到 'lnmp'...
warning: 您似乎克隆了一个空版本库。
[root@jenkins ~]# cd lnmp/
[root@jenkins lnmp]# yum -y install tree
[root@jenkins lnmp]# tree   #上传lnmp目录
.
└── lnmp
    ├── conf
    │   └── default.conf
    ├── docker-compose.yml
    └── html
        ├── dbtest.php
        ├── index.html
        └── test.php
3 directories, 5 files
[root@jenkins lnmp]# git add .
[root@jenkins lnmp]# git commit -m "add lnmp"
[master(根提交) ed73f9c] add lnmp
 5 files changed, 74 insertions(+)
 create mode 100644 lnmp/conf/default.conf
 create mode 100644 lnmp/docker-compose.yml
 create mode 100644 lnmp/html/dbtest.php
 create mode 100644 lnmp/html/index.html
 create mode 100644 lnmp/html/test.php
[root@jenkins lnmp]# git push origin master
Counting objects: 10, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (10/10), 1.30 KiB | 0 bytes/s, done.
Total 10 (delta 0), reused 0 (delta 0)
To git@192.168.100.202:root/lnmp.git
 * [new branch]      master -> master

在浏览器验证

91b6fd40437e4c7bb98765bf65ea5c07.png


(6)在Jenkins创建并配置流水线项目


-先在测试环境进行项目部署


b2f1cc96a200457685cf1d46fc4f723f.png

点击这里去生产流水线语法

9a2a9b7961d14d838eb426df755dae40.png

657891d2c91b4fe498acfefeb5caab28.png

8e77acdc85b942a59af8b3ef5a60c357.png

#语法(把刚才生成的git拉取数据的语句复制过来):
pipeline {
    agent any
    stages {
        stage("gitlab") {
           steps {
               git credentialsId: '948ac17c-2c14-4a8d-9120-95eb8c2b86aa', url: 'git@192.168.100.202:root/lnmp.git'
           }  
         }
    }
}
在保存后可以先进行测试

27c2ea2b961e4eca87741821fe8b49a9.png999057bfcbf24f8aa7cb2e93362b41d3.png


测试成功!

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
18天前
|
jenkins 测试技术 持续交付
软件测试|docker搭建Jenkins+Python+allure自动化测试环境
通过以上步骤,你可以在Docker中搭建起Jenkins自动化测试环境,实现Python测试的自动化执行和Allure报告生成。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
38 6
|
27天前
|
jenkins Java 持续交付
Docker搭建持续集成平台Jenkins最简教程
Jenkins 是一个广泛使用的开源持续集成工具,它能够自动化构建、测试和部署软件项目。在本文中,我们将使用 Docker 搭建一个基于 Jenkins 的持续集成平台。
111 2
|
30天前
|
JavaScript Go 项目管理
云效常见问题之使用gitlab仓库将代码合并评审环节集成到云效如何解决
云效(CloudEfficiency)是阿里云提供的一套软件研发效能平台,旨在通过工程效能、项目管理、质量保障等工具与服务,帮助企业提高软件研发的效率和质量。本合集是云效使用中可能遇到的一些常见问题及其答案的汇总。
92 1
|
1月前
|
JavaScript Java jenkins
如何利用CentOS7+docker+jenkins+gitee部署springboot+vue前后端项目(保姆教程)
如何利用CentOS7+docker+jenkins+gitee部署springboot+vue前后端项目(保姆教程)
84 0
|
1月前
|
jenkins Java 持续交付
Docker Swarm总结+Jenkins安装配置与集成(5/5)
Docker Swarm总结+Jenkins安装配置与集成(5/5)
49 0
|
1月前
|
Devops 开发工具 数据安全/隐私保护
Docker Swarm总结+CI/CD Devops、gitlab、sonarqube以及harbor的安装集成配置(3/5)
Docker Swarm总结+CI/CD Devops、gitlab、sonarqube以及harbor的安装集成配置(3/5)
51 0
|
1月前
|
jenkins Java 持续交付
Docker Swarm总结+Jenkins安装配置与集成snarqube和目标服务器(4/5)
Docker Swarm总结+Jenkins安装配置与集成snarqube和目标服务器(4/5)
44 0
|
1月前
|
NoSQL 关系型数据库 MySQL
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
Docker安装详细步骤及相关环境安装配置(mysql、jdk、redis、自己的私有仓库Gitlab 、C和C++环境以及Nginx服务代理)
204 0
|
2月前
|
jenkins Java 持续交付
Docker 安装 Jenkins 2.414
【2月更文挑战第1天】 Docker 安装 Jenkins 2.414 镜像下载、插件配置
114 3
Docker 安装 Jenkins 2.414
|
2月前
|
数据安全/隐私保护 Docker 容器
【Docker】安装gitlab 傻瓜式复制安装
【Docker】安装gitlab 傻瓜式复制安装
58 0