本文介绍了如何使用Travis-CI在CentOS 7上运行测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用。



我收到错误:



有没有办法在CentOS 7上运行ansible playbook测试?



所以我更新了/ etc / default / docker:

  DOCKER_OPTS = - s devicemapper

重新启动docker:
service docker restart



docker run --rm = true -ti centos:7 / bin / bash



  [root @ 16702cbf3f2c /]#yum install -y httpd 
加载的插件:fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
systemdcontainer | 1.9 kB 00:00:00
更新| 3.4 kB 00:00:00
(1/4):base / 7 / x86_64 / group_gz | 154 kB 00:00:03
(2/4):extras / 7 / x86_64 / primary_db | 74 kB 00:00:04
(3/4):updates / 7 / x86_64 / primary_db | 3.3 MB 00:01:10
(4/4):base / 7 / x86_64 / primary_db | 5.1 MB 00:01:22
systemdcontainer / primary_db | 20 kB 00:00:01
确定最快镜像
* base:centos.syn.co.il
* extras:centos.syn.co.il
*更新:centos .syn.co.il
解析依赖关系
- >运行交易支票
--->软件包httpd.x86_64 0:2.4.6-31.el7.centos.1将被安装
- >处理依赖关系:httpd-tools = 2.4.6-31.el7.centos.1 for package:httpd-2.4.6-31.el7.centos.1.x86_64
- >处理依赖关系:system-logos> = 7.92.1-1包:httpd-2.4.6-31.el7.centos.1.x86_64
- >处理依赖关系:/etc/mime.types包:httpd-2.4.6-31.el7.centos.1.x86_64
- >处理依赖关系:libaprutil-1.so.0()(64位)包:httpd-2.4.6-31.el7.centos.1.x86_64
- >处理依赖关系:libapr-1.so.0()(64位)包:httpd-2.4.6-31.el7.centos.1.x86_64
- >运行交易支票
--->软件包apr.x86_64 0:1.4.8-3.el7将被安装
--->软件包apr-util.x86_64 0:1.5.2-6.el7将被安装
--->软件包centos-logos.noarch 0:70.0.6-2.el7.centos将被安装
--->软件包httpd-tools.x86_64 0:2.4.6-31.el7.centos.1将被安装
--->软件包mailcap.noarch 0:2.1.41-2.el7将被安装
- >已完成的依赖解决方案

已解决的依赖关系

========================= ================================================== $ {
}软件包版本存储库大小
===================================== ================================================== ================================
安装:
httpd x86_64 2.4.6- 31.el7.centos.1更新2.7 M
为依赖安装:
apr x86_64 1.4.8-3.el7 base 103 k
apr-util x86_64 1.5.2-6.el7 base 92 k
centos-logos noarch 70.0.6-2.el7.centos更新21 M
httpd-tools x86_64 2.4.6-31.el7.centos.1更新79 k
mailcap noarch 2.1.41-2.el7 base 31 k

事务总结
========================================= ================================================== ============================
安装1个软件包(+5个相关软件包)

总下载大小:24 M
安装尺寸:32 M
下载包:
warning:/var/cache/yum/x86_64/7/updates/packages/httpd-tools-2.4。 6-31.el7.centos.1.x86_64.rpm:标题V3 RSA / SHA256签名,密钥ID f4a80eb5:NOKEY
httpd-tools-2.4.6-31.el7.centos.1.x86_64的公钥.rpm没有安装
(1/6):httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm | 79 kB 00:00:03
未安装apr-util-1.5.2-6.el7.x86_64.rpm的公钥
(2/6):apr-util-1.5.2- 6.el7.x86_64.rpm | 92 kB 00:00:04
(3/6):mailcap-2.1.41-2.el7.noarch.rpm | 31 kB 00:00:02
(4/6):apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00:06
(5/6):httpd-2.4.6-31.el7.centos.1.x86_64.rpm | 2.7 MB 00:00:52
(6/6):centos-logos-70.0.6-2.el7.centos.noarch.rpm | 21 MB 00:01:11
--------------------------------------- -------------------------------------------------- ------------------------------------
总计349 kB / s | 24 MB 00:01:11
从文件中获取密钥:/// etc / pki / rpm-gpg / RPM-GPG-KEY-CentOS-7
导入GPG密钥0xF4A80EB5:
用户名:CentOS-7密钥(CentOS 7官方签名密钥)< [email protected]>
指纹:6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
包装:centos-release-7-1.1503.el7.centos.2.8.x86_64(@CentOS)
从:/ etc / pki / rpm-gpg / RPM-GPG-KEY-CentOS-7
运行事务检查
运行事务测试
事务测试成功
运行事务
安装:apr- 1.4.8-3.el7.x86_64 1/6
安装:apr-util-1.5.2-6.el7.x86_64 2/6
安装:httpd-tools-2.4.6-31。 el7.centos.1.x86_64 3/6
安装:mailcap-2.1.41-2.el7.noarch 4/6
安装:centos-logos-70.0.6-2.el7.centos。 noarch 5/6
安装:httpd-2.4.6 -31.el7.centos.1.x86_64 6/6
验证:centos-logos-70.0.6-2.el7.centos.noarch 1/6
验证:apr-1.4.8-3 .el7.x86_64 2/6
验证:mailcap-2.1.41-2.el7.noarch 3/6
验证:apr-util-1.5.2-6.el7.x86_64 4/6
验证:httpd-tools-2.4.6-31.el7.centos.1.x86_64 5/6
验证:httpd-2.4.6-31.el7.centos.1.x86_64 6/6

已安装:
httpd.x86_64 0:2.4.6-31.el7.centos.1

依赖关系已安装:
apr.x86_64 0:1 。 4.8-3.el7 apr-util.x86_64 0:1.5.2-6.el7 centos-logos.noarch 0:70.0.6-2.el7.centos
httpd-tools.x86_64 0:2.4.6- 31.el7.centos.1 mailcap.noarch 0:2.1.41-2.el7

完成!

如果有可能在Travis CI上执行相同操作。我没有在手册中找到。



我无法编辑docker设置:

  $ echo'DOCKER_OPTS = -  s devicemapper'>>的/ etc /默认/搬运工; service docker restart 
/home/travis/build.sh:第41行:/ etc / default / docker:Permission denied
/etc/init.d/docker:38:。:无法打开/ etc / default / docker


解决方案

由于Travis CI Docker bug有办法使用新版本的Docker。感谢Travis CI团队的Dominic Jodoin。
.travis.yml:

  sudo:required 
env:
#matrix:
- OS_TYPE = centos OS_VERSION = 6 ANSIBLE_VERSION = 1.9.2

branches:
only:
- master
# - stable

服务:
- docker

before_install:
- sudo apt-get update
- sudo apt-get upgrade lxc-docker
- echo' DOCKER_OPTS = - H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper'| sudo tee / etc / default / docker> / dev / null
- sudo service docker restart
- sleep 5
- sudo docker pull weldpua2008 / docker-ansible:$ {OS_TYPE} $ {OS_VERSION} _v $ {ANSIBLE_VERSION}

脚本:
#在Container
运行测试 - sudo docker运行--rm = true -v`pwd`:/ ansible-apache:rw weldpua2008 / docker-ansible:$ {OS_TYPE } $ {OS_VERSION} _v $ {ANSIBLE_VERSION} / bin / bash -c/ansible-apache/tests/test-in-docker-image.sh $ {OS_TYPE} $ {OS_VERSION} $ {ANSIBLE_VERSION}

通知:
电子邮件:false


I try to use Travis-CI to test my ansible playbooks on CentOS 7.

I got an error:error: unpacking of archive failed on file /usr/sbin/suexec: cpio: cap_set_file.

Also I installed docker with:

curl -sSL https://get.docker.com/ | sh

on my Ubuntu:

# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty

But there is this error:

#docker run --rm=true -ti centos:7 /bin/bash
[root@08bf52d53465 /]#
[root@ca03cf7a13e2 /]# yum install httpd -y
Loaded plugins: fastestmirror
base                                                                                                  | 3.6 kB  00:00:00
extras                                                                                                | 3.4 kB  00:00:00
updates                                                                                               | 3.4 kB  00:00:00
(1/4): extras/7/x86_64/primary_db                                                                     |  74 kB  00:00:00
(2/4): base/7/x86_64/group_gz                                                                         | 154 kB  00:00:01
(3/4): updates/7/x86_64/primary_db                                                                    | 3.3 MB  00:00:06
(4/4): base/7/x86_64/primary_db                                                                       | 5.1 MB  00:00:06
Determining fastest mirrors
 * base: mirror.nonstop.co.il
 * extras: centos.joinweb.co.il
 * updates: centos.joinweb.co.il
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-31.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-31.el7.centos.1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package centos-logos.noarch 0:70.0.6-2.el7.centos will be installed
---> Package httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                       Arch                    Version                                Repository                Size
=============================================================================================================================
Installing:
 httpd                         x86_64                  2.4.6-31.el7.centos.1                  updates                  2.7 M
Installing for dependencies:
 apr                           x86_64                  1.4.8-3.el7                            base                     103 k
 apr-util                      x86_64                  1.5.2-6.el7                            base                      92 k
 centos-logos                  noarch                  70.0.6-2.el7.centos                    updates                   21 M
 httpd-tools                   x86_64                  2.4.6-31.el7.centos.1                  updates                   79 k
 mailcap                       noarch                  2.1.41-2.el7                           base                      31 k

Transaction Summary
=============================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 24 M
Installed size: 32 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/apr-1.4.8-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for apr-1.4.8-3.el7.x86_64.rpm is not installed
(1/6): apr-1.4.8-3.el7.x86_64.rpm                                                                     | 103 kB  00:00:00
(2/6): mailcap-2.1.41-2.el7.noarch.rpm                                                                |  31 kB  00:00:00
(3/6): apr-util-1.5.2-6.el7.x86_64.rpm                                                                |  92 kB  00:00:00
Public key for httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm is not installed               ] 559 kB/s | 764 kB  00:00:43 ETA
(4/6): httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm                                                   |  79 kB  00:00:01
(5/6): httpd-2.4.6-31.el7.centos.1.x86_64.rpm                                                         | 2.7 MB  00:00:03
(6/6): centos-logos-70.0.6-2.el7.centos.noarch.rpm                                                    |  21 MB  00:00:16
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        1.5 MB/s |  24 MB  00:00:16
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-1.1503.el7.centos.2.8.x86_64 (@CentOS)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                                                    1/6
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                               2/6
  Installing : httpd-tools-2.4.6-31.el7.centos.1.x86_64                                                                  3/6
  Installing : mailcap-2.1.41-2.el7.noarch                                                                               4/6
  Installing : centos-logos-70.0.6-2.el7.centos.noarch                                                                   5/6
  Installing : httpd-2.4.6-31.el7.centos.1.x86_64                                                                        6/6
Error unpacking rpm package httpd-2.4.6-31.el7.centos.1.x86_64
error: unpacking of archive failed on file /usr/sbin/suexec: cpio: cap_set_file
error: httpd-2.4.6-31.el7.centos.1.x86_64: install failed
  Verifying  : centos-logos-70.0.6-2.el7.centos.noarch                                                                   1/6
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                                    2/6
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                               3/6
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                               4/6
  Verifying  : httpd-tools-2.4.6-31.el7.centos.1.x86_64                                                                  5/6
  Verifying  : httpd-2.4.6-31.el7.centos.1.x86_64                                                                        6/6

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7                      apr-util.x86_64 0:1.5.2-6.el7    centos-logos.noarch 0:70.0.6-2.el7.centos
  httpd-tools.x86_64 0:2.4.6-31.el7.centos.1    mailcap.noarch 0:2.1.41-2.el7

Failed:
  httpd.x86_64 0:2.4.6-31.el7.centos.1

Complete!
[root@ca03cf7a13e2 /]#

I created "special" docker image that includes an Ansible https://github.com/weldpua2008/docker-ansible/blob/ansible_1.9.2/centos/7/Dockerfile

Is there any possibilities to run tests of ansible playbook on CentOS 7?

So I updated /etc/default/docker with:

DOCKER_OPTS="-s devicemapper"

restarted docker: service docker restart

docker run --rm=true -ti centos:7 /bin/bash

[root@16702cbf3f2c /]# yum install -y httpd
Loaded plugins: fastestmirror
base                                                                                                  | 3.6 kB  00:00:00
extras                                                                                                | 3.4 kB  00:00:00
systemdcontainer                                                                                      | 1.9 kB  00:00:00
updates                                                                                               | 3.4 kB  00:00:00
(1/4): base/7/x86_64/group_gz                                                                         | 154 kB  00:00:03
(2/4): extras/7/x86_64/primary_db                                                                     |  74 kB  00:00:04
(3/4): updates/7/x86_64/primary_db                                                                    | 3.3 MB  00:01:10
(4/4): base/7/x86_64/primary_db                                                                       | 5.1 MB  00:01:22
systemdcontainer/primary_db                                                                           |  20 kB  00:00:01
Determining fastest mirrors
 * base: centos.syn.co.il
 * extras: centos.syn.co.il
 * updates: centos.syn.co.il
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-31.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-31.el7.centos.1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-31.el7.centos.1.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-3.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package centos-logos.noarch 0:70.0.6-2.el7.centos will be installed
---> Package httpd-tools.x86_64 0:2.4.6-31.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
 Package                       Arch                    Version                                Repository                Size
=============================================================================================================================
Installing:
 httpd                         x86_64                  2.4.6-31.el7.centos.1                  updates                  2.7 M
Installing for dependencies:
 apr                           x86_64                  1.4.8-3.el7                            base                     103 k
 apr-util                      x86_64                  1.5.2-6.el7                            base                      92 k
 centos-logos                  noarch                  70.0.6-2.el7.centos                    updates                   21 M
 httpd-tools                   x86_64                  2.4.6-31.el7.centos.1                  updates                   79 k
 mailcap                       noarch                  2.1.41-2.el7                           base                      31 k

Transaction Summary
=============================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 24 M
Installed size: 32 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/updates/packages/httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm is not installed
(1/6): httpd-tools-2.4.6-31.el7.centos.1.x86_64.rpm                                                   |  79 kB  00:00:03
Public key for apr-util-1.5.2-6.el7.x86_64.rpm is not installed
(2/6): apr-util-1.5.2-6.el7.x86_64.rpm                                                                |  92 kB  00:00:04
(3/6): mailcap-2.1.41-2.el7.noarch.rpm                                                                |  31 kB  00:00:02
(4/6): apr-1.4.8-3.el7.x86_64.rpm                                                                     | 103 kB  00:00:06
(5/6): httpd-2.4.6-31.el7.centos.1.x86_64.rpm                                                         | 2.7 MB  00:00:52
(6/6): centos-logos-70.0.6-2.el7.centos.noarch.rpm                                                    |  21 MB  00:01:11
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                        349 kB/s |  24 MB  00:01:11
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-1.1503.el7.centos.2.8.x86_64 (@CentOS)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-3.el7.x86_64                                                                                    1/6
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                               2/6
  Installing : httpd-tools-2.4.6-31.el7.centos.1.x86_64                                                                  3/6
  Installing : mailcap-2.1.41-2.el7.noarch                                                                               4/6
  Installing : centos-logos-70.0.6-2.el7.centos.noarch                                                                   5/6
  Installing : httpd-2.4.6-31.el7.centos.1.x86_64                                                                        6/6
  Verifying  : centos-logos-70.0.6-2.el7.centos.noarch                                                                   1/6
  Verifying  : apr-1.4.8-3.el7.x86_64                                                                                    2/6
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                               3/6
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                               4/6
  Verifying  : httpd-tools-2.4.6-31.el7.centos.1.x86_64                                                                  5/6
  Verifying  : httpd-2.4.6-31.el7.centos.1.x86_64                                                                        6/6

Installed:
  httpd.x86_64 0:2.4.6-31.el7.centos.1

Dependency Installed:
  apr.x86_64 0:1.4.8-3.el7                      apr-util.x86_64 0:1.5.2-6.el7    centos-logos.noarch 0:70.0.6-2.el7.centos
  httpd-tools.x86_64 0:2.4.6-31.el7.centos.1    mailcap.noarch 0:2.1.41-2.el7

Complete!

If there any possibility to do same on Travis CI. I didn't find in the manual http://docs.travis-ci.com/user/docker/ .

I can't edit docker settings https://travis-ci.org/weldpua2008/ansible-apache/jobs/79963906#L29:

$ echo 'DOCKER_OPTS="-s devicemapper"' >> /etc/default/docker; service docker restart
/home/travis/build.sh: line 41: /etc/default/docker: Permission denied
/etc/init.d/docker: 38: .: Can't open /etc/default/docker
解决方案

Because of Travis CI Docker bug there is way to use new version of Docker. Thank to Dominic Jodoin from Travis CI team..travis.yml:

sudo: required
env:
  #matrix:
  - OS_TYPE=centos OS_VERSION=6 ANSIBLE_VERSION=1.9.2

branches:
  only:
  - master
#  - stable

services:
  - docker

before_install:
  - sudo apt-get update
  - sudo apt-get upgrade lxc-docker
  - echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock -s devicemapper"' | sudo tee /etc/default/docker > /dev/null
  - sudo service docker restart
  - sleep 5
  - sudo docker pull weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION}

script:
 # Run tests in Container
 - sudo docker run --rm=true -v `pwd`:/ansible-apache:rw weldpua2008/docker-ansible:${OS_TYPE}${OS_VERSION}_v${ANSIBLE_VERSION} /bin/bash -c "/ansible-apache/tests/test-in-docker-image.sh ${OS_TYPE} ${OS_VERSION} ${ANSIBLE_VERSION}"

notifications:
  email: false

这篇关于如何使用Travis-CI在CentOS 7上运行测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 16:38