Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run tests on CentOS 7 with Travis-CI?

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
like image 280
Valeriy Solovyov Avatar asked Sep 12 '15 04:09

Valeriy Solovyov


1 Answers

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
like image 170
Valeriy Solovyov Avatar answered Oct 22 '22 07:10

Valeriy Solovyov