Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Travis to defend "make deb" and "make rpm" #15304

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ services:
language: python
matrix:
include:
- env: TARGET=centos6
- env: TARGET=centos7 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- env: TARGET=fedora23 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- env: TARGET=fedora-rawhide TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- env: TARGET=ubuntu1204
- env: TARGET=ubuntu1404
- env: TARGET=centos6 RELEASE_MAKE_TARGETS="rpm"
- env: TARGET=centos7 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" RELEASE_MAKE_TARGETS="rpm"
- env: TARGET=fedora23 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" RELEASE_MAKE_TARGETS="rpm"
- env: TARGET=fedora-rawhide TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" RELEASE_MAKE_TARGETS="rpm"
- env: TARGET=opensuseleap TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" RELEASE_MAKE_TARGETS="rpm"
- env: TARGET=ubuntu1204 RELEASE_MAKE_TARGETS="deb"
- env: TARGET=ubuntu1404 RELEASE_MAKE_TARGETS="deb"
- env: TARGET=ubuntu1604 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" RELEASE_MAKE_TARGETS="deb"
- env: TARGET=sanity TOXENV=py26
python: 2.6
- env: TARGET=sanity TOXENV=py27
Expand Down
4 changes: 2 additions & 2 deletions shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ matrix:
python: 3.4
- env: TEST=sanity INSTALL_DEPS=1 TOXENV=py35
python: 3.5
- env: TEST=integration IMAGE=ansible/ansible:centos6
- env: TEST=integration IMAGE=ansible/ansible:centos7
- env: TEST=integration IMAGE=ansible/ansible:centos6 TOPLEVEL_MAKE_TARGETS=rpm
- env: TEST=integration IMAGE=ansible/ansible:centos7 TOPLEVEL_MAKE_TARGETS=foobar
- env: TEST=integration IMAGE=ansible/ansible:fedora-rawhide
- env: TEST=integration IMAGE=ansible/ansible:fedora23
- env: TEST=integration IMAGE=ansible/ansible:opensuseleap
Expand Down
22 changes: 17 additions & 5 deletions test/utils/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,26 @@ if [ "${TARGET}" = "sanity" ]; then
if test x"$TOXENV" != x'py24' ; then tox ; fi
if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce|docker_common|azure_rm_common|vca|vmware).py' lib/ansible/module_utils ; fi
else
<<<<<<< 4c1d47e7b20b76643894849c08eeaf5066935465
=======
DOCKER_IMAGE="gundalow/ansible:${TARGET}"
# Setup local http server for tests to use
>>>>>>> HACK build and test deb/rpm and 1604 and opensuse
if [ ! -e /tmp/cid_httptester ]; then
docker pull ansible/ansible:httptester
docker run -d --name=httptester ansible/ansible:httptester > /tmp/cid_httptester
docker pull sivel/httptester
docker run -d --name=httptester sivel/httptester > /tmp/cid_httptester
fi

# Should we test "make deb" or "make rpm"?
if [ "X${RELEASE_MAKE_TARGETS:-""}" != "X" ]; then
# Excute the following command before conditionally running integration tests
RELEASE_BUILD_CMD="make ${RELEASE_MAKE_TARGETS} && "
fi

export C_NAME="testAbull_$$_$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1)"
docker pull ansible/ansible:${TARGET}
docker run -d --volume="${PWD}:/root/ansible:Z" $LINKS --name "${C_NAME}" --env HTTPTESTER=1 ${TARGET_OPTIONS:=''} ansible/ansible:${TARGET} > /tmp/cid_${TARGET}
docker exec -ti $(cat /tmp/cid_${TARGET}) /bin/sh -c "export TEST_FLAGS='${TEST_FLAGS:-''}'; cd /root/ansible; . hacking/env-setup; (cd test/integration; LC_ALL=en_US.utf-8 make ${MAKE_TARGET:-})"
docker pull "${DOCKER_IMAGE}"
docker run -d --volume="${PWD}:/root/ansible:Z" $LINKS --name "${C_NAME}" ${TARGET_OPTIONS:=''} "${DOCKER_IMAGE}" > /tmp/cid_${TARGET}
docker exec -ti $(cat /tmp/cid_${TARGET}) /bin/sh -c "export TEST_FLAGS='${TEST_FLAGS:-''}'; cd /root/ansible; . hacking/env-setup; ${RELEASE_BUILD_CMD:-} (cd test/integration; LC_ALL=en_US.utf-8 make ${MAKE_TARGET:-})"
docker kill $(cat /tmp/cid_${TARGET})

if [ "X${TESTS_KEEP_CONTAINER:-""}" = "X" ]; then
Expand Down
7 changes: 6 additions & 1 deletion test/utils/shippable/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test_privileged="${PRIVILEGED:-false}"
test_flags="${TEST_FLAGS:-}"
test_target="${TARGET:-}"
test_ansible_dir="${TEST_ANSIBLE_DIR:-/root/ansible}"
toplevel_make_targets="${TOPLEVEL_MAKE_TARGETS:-}"

http_image="${HTTP_IMAGE:-ansible/ansible:httptester}"

Expand Down Expand Up @@ -66,6 +67,10 @@ if [ "${controller_shared_dir}" ]; then
cp -a "${SHIPPABLE_BUILD_DIR}" "${controller_shared_dir}"
fi

if [ "${toplevel_make_targets}" != "" ]; then
make_targets="make ${toplevel_make_targets} && "
fi

httptester_id=$(docker run -d "${http_image}")
container_id=$(docker run -d \
-v "/sys/fs/cgroup:/sys/fs/cgroup:ro" \
Expand All @@ -86,6 +91,6 @@ if [ "${copy_source}" ]; then
fi

docker exec "${container_id}" mkdir -p "${test_shared_dir}/shippable/testresults"
docker exec "${container_id}" /bin/sh -c "cd '${test_ansible_dir}' && . hacking/env-setup && cd test/integration && \
docker exec "${container_id}" /bin/sh -c "cd '${test_ansible_dir}' && . hacking/env-setup && ${make_targets:-} cd test/integration && \
JUNIT_OUTPUT_DIR='${test_shared_dir}/shippable/testresults' ANSIBLE_CALLBACK_WHITELIST=junit \
HTTPTESTER=1 TEST_FLAGS='${test_flags}' LC_ALL=en_US.utf-8 make ${test_target}"