jenkins自动打包部署到指定目录

36次阅读

共计 5611 个字符,预计需要花费 15 分钟才能阅读完成。

前因后果

最近工作不忙,研究一下自动化打包,要实现的目标是通过 jenkins 自动打包,拷贝到指定目录

目标

git 更新了代码,jenkins 自动打包部署

第一部 安装 jenkins

看了一下文档 jenkins 竟然需要 Docker 安装 …. 惊呆了????

安装 Docker

  1. 安装依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2 
  1. 添加 docker-ce yum 仓库

用的阿里的源

sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

报错:

已加载插件:fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 416 Requested Range Not Satisfiable"
尝试其他镜像。Could not fetch/save url http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 416 Requested Range Not Satisfiable"

查了一下 有说改源的,有改配置文件的,其实是在:/etc/yum.repos.d 下发现已经有了一个 docker-ce.repo 文件 删掉就可以了

然后继续报错,缺少一堆包,

踩坑记,一定要先查看自己系统的版本,我们的版本是 CentOS6.8 新的版本需要的是 CentOS 7 至于我们运维为什么装这么老的系统不得而知,我感觉后边还要坑我

CentOS6.8 上安装 docker

mmp!
参考:http://www.cnblogs.com/zhenyu…
安装 epel

rpm -iUvh http://dl.fedoraproject.org/p…
安装 docker

yum install docker-io
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                                                                                                                                          | 6.2 kB     00:00     
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.sohu.com
epel                                                                                                                                                                                                                                                   | 4.3 kB     00:00     
epel/primary_db                                                                                                                                                                                                                                        | 5.9 MB     00:01     
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:1.7.1-2.el6 will be installed
--> Processing Dependency: lxc for package: docker-io-1.7.1-2.el6.x86_64
--> Running transaction check
---> Package lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-lxc(x86-64) = 1.0.10-2.el6 for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: lua-alt-getopt for package: lxc-1.0.10-2.el6.x86_64
--> Processing Dependency: liblxc.so.1()(64bit) for package: lxc-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-alt-getopt.noarch 0:0.7.0-1.el6 will be installed
---> Package lua-lxc.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: lua-filesystem for package: lua-lxc-1.0.10-2.el6.x86_64
---> Package lxc-libs.x86_64 0:1.0.10-2.el6 will be installed
--> Processing Dependency: rsync for package: lxc-libs-1.0.10-2.el6.x86_64
--> Running transaction check
---> Package lua-filesystem.x86_64 0:1.4.2-1.el6 will be installed
---> Package rsync.x86_64 0:3.0.6-12.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================================================================================================================================
 Package                                Arch                        Version                          Repository                                                   Size
=====================================================================================================================================================================================================
Installing:
 docker-io                             x86_64                      1.7.1-2.el6                      epel                                                        4.6 M
Installing for dependencies:
 lua-alt-getopt                       noarch                       0.7.0-1.el6                      epel                                                        6.9 k
 lua-filesystem                       x86_64                       1.4.2-1.el6                      epel                                                         24 k
 lua-lxc                              x86_64                       1.0.10-2.el6                     epel                                                         16 k
 lxc                                  x86_64                       1.0.10-2.el6                     epel                                                        124 k
 lxc-libs                             x86_64                       1.0.10-2.el6                     epel                                                        258 k
 rsync                                x86_64                       3.0.6-12.el6                     base                                                        335 k

Transaction Summary
=====================================================================================================================================================================================================
Install       7 Package(s)

Total download size: 5.3 M
Installed size: 21 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): docker-io-1.7.1-2.el6.x86_64.rpm                                                                                                                                                                                                                | 4.6 MB     00:04     
(2/7): lua-alt-getopt-0.7.0-1.el6.noarch.rpm                                                                                                                                                                                                           | 6.9 kB     00:00     
(3/7): lua-filesystem-1.4.2-1.el6.x86_64.rpm                                                                                                                                                                                                           |  24 kB     00:00     
(4/7): lua-lxc-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                 |  16 kB     00:00     
(5/7): lxc-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                     | 124 kB     00:00     
(6/7): lxc-libs-1.0.10-2.el6.x86_64.rpm                                                                                                                                                                                                                | 258 kB     00:00     
(7/7): rsync-3.0.6-12.el6.x86_64.rpm                                                                                                                                                                                                                   | 335 kB     00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         502 kB/s | 5.3 MB     00:10     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : lua-filesystem-1.4.2-1.el6.x86_64                                                                                                                                                                                                                          1/7 
  Installing : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                                                                          2/7 
  Installing : rsync-3.0.6-12.el6.x86_64                                                                                                                                                                                                                                  3/7 
  Installing : lxc-libs-1.0.10-2.el6.x86_64                                                                                                                                                                                                                               4/7 
  Installing : lua-lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                5/7 
  Installing : lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                    6/7 
  Installing : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                                                               7/7 
  Verifying  : lua-lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                1/7 
  Verifying  : lxc-libs-1.0.10-2.el6.x86_64                                                                                                                                                                                                                               2/7 
  Verifying  : lxc-1.0.10-2.el6.x86_64                                                                                                                                                                                                                                    3/7 
  Verifying  : docker-io-1.7.1-2.el6.x86_64                                                                                                                                                                                                                               4/7 
  Verifying  : rsync-3.0.6-12.el6.x86_64                                                                                                                                                                                                                                  5/7 
  Verifying  : lua-alt-getopt-0.7.0-1.el6.noarch                                                                                                                                                                                                                          6/7 
  Verifying  : lua-filesystem-1.4.2-1.el6.x86_64                                                                                                                                                                                                                          7/7 

Installed:
  docker-io.x86_64 0:1.7.1-2.el6                                                                                                                                                                                                                                              

Dependency Installed:
  lua-alt-getopt.noarch 0:0.7.0-1.el6              lua-filesystem.x86_64 0:1.4.2-1.el6              lua-lxc.x86_64 0:1.0.10-2.el6              lxc.x86_64 0:1.0.10-2.el6              lxc-libs.x86_64 0:1.0.10-2.el6              rsync.x86_64 0:3.0.6-12.el6             

Complete!

注意:
最 docker-1.10 以后彻底放弃了 lxc 转而使用 libcontainer(go). 建议安装最新的 docker 使用 centos7.

这样 docker 安装成功
来继续 Jenkins

sudo docker pull jenkins
2019/09/19 15:50:16 Can't connect to docker daemon. Is'docker -d' running on this host?

没解决方案,放弃了 感觉是防火墙之类的问题 隔绝了服务,
考虑直接安装 Jenkins

直接安装 Jenkins 就简单多了

sudo yum install jenkins
sudo service jenkins start

就启动了 jenkins 服务

正文完
 0