Как запустить тесты на CentOS 7 С помощью Travis-CI?

Я пытаюсь использовать Трэвис-CI, чтобы проверить мои ansible playbooks на CentOS 7.

я получил ошибку: ошибка: не удалось распаковать архив в файле / usr/sbin / suexec: cpio: cap_set_file.

также я установил docker с:

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

на моем Ubuntu:

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

но есть такая ошибка:

#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) <security@centos.org>"
 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 /]#

Я создал" специальное " изображение докера, которое включает Ansible https://github.com/weldpua2008/docker-ansible/blob/ansible_1.9.2/centos/7/Dockerfile

есть ли какие-либо возможности для запуска тестов ansible playbook на CentOS 7?

поэтому я обновил /etc / default / docker с помощью:

DOCKER_OPTS="-s devicemapper"

перезапустить докер: перезапуск службы docker

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) <security@centos.org>"
 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!

если есть возможность сделать то же самое на Travis CI. Я не нашел в руководстве http://docs.travis-ci.com/user/docker/ .

Я не могу редактировать настройки docker 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

2 ответов


из-за ошибки Travis CI Docker есть способ использовать новую версию Docker. Спасибо Йодозин Доминик из команды Трэвиса ки. .Трэвис.в формате 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

вы можете рассмотреть возможность использования Circle CI. Он очень похож на Travis CI (интеграция с GitHub, конфигурация yaml), но быстрее. И это бесплатно для open source! Вот некоторые документы о docker:

https://circleci.com/docs/docker/