diff --git a/Dockerfile b/Dockerfile index 6f69df397..d0d028e5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,59 +1,3 @@ FROM docker.io/stackbrew/centos:7 MAINTAINER cevich@redhat.com -################################################################################ -# Configuration Options -################################################################################ -ENV AUTOTEST_PATH="/usr/local/autotest" \ - DOCKER_AUTOTEST_PATH="/usr/local/autotest/client/tests/docker" \ - AUTOTEST_URL="https://github.com/autotest/autotest.git" \ - PROTECT_IMAGES="stackbrew/centos:7, stackbrew/centos:latest" \ - PROTECT_CONTAINERS="" \ - REPO_INSTALL="yum install -y \ -http://linux.mirrors.es.net/fedora-epel/7/x86_64/e/epel-release-7-5.noarch.rpm" \ - INSTALL_RPMS="procps tar findutils bzip2 gdb bridge-utils \ -nfs-utils git glibc-devel python-sphinx python-bugzilla which pylint \ -make python-pep8 python-sphinxcontrib-httpdomain" \ - SWITCH_VERSION="yes" \ - TESTS_CONFIG="yes" \ - DEFAULTS_CONFIG="yes" \ - LC_ALL="C" \ - PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin" -################################################################################ -LABEL INSTALL="/usr/bin/docker run \ ---interactive \ ---rm \ ---privileged \ ---net=host \ ---ipc=host \ ---pid=host \ ---env HOST=/host \ ---env NAME=NAME \ ---env IMAGE=IMAGE \ ---volume /run:/run \ ---volume /var/log:/var/log \ ---volume /:/host \ ---read-only \ ---name NAME \ -IMAGE \ -/usr/local/autotest/client/tests/docker/atomic/atomic_install.sh" -LABEL RUN="/usr/local/autotest/client/autotest-local run docker" -LABEL UNINSTALL="rm -rf /usr/local/autotest" -################################################################################ -RUN yum --disablerepo="*-eus-*" --disablerepo="*-htb-*" --disablerepo="*-ha-*" \ - --disablerepo="*-rt-*" --disablerepo="*-lb-*" --disablerepo="*-rs-*" \ - --disablerepo="*-sap-*" --disablerepo="*beta*" \ - install -y deltarpm yum-utils && \ - yum-config-manager --disable "*-eus-*" "*-htb-*" "*-ha-*" "*-rt-*" \ - "*-lb-*" "*-rs-*" "*-sap-*" "*beta*" &> /dev/null && \ - yum-config-manager --enable "*-optional-rpms" &> /dev/null && \ - yum update -y && \ - ${REPO_INSTALL} && \ - yum install -y ${INSTALL_RPMS} && \ - yum clean all && \ - rm -rf /usr/share/doc/* && \ - rm -rf /usr/share/man/* -RUN git clone --single-branch ${AUTOTEST_URL} ${AUTOTEST_PATH} -################################################################################ -ADD / /${DOCKER_AUTOTEST_PATH}/ -WORKDIR ${AUTOTEST_PATH}/client -RUN echo -e "\nComplete installation with 'atomic install IMAGE'\n" +RUN echo -e "\nIt works!\n" diff --git a/atomic/atomic_install.sh b/atomic/atomic_install.sh deleted file mode 100755 index ac6203d0a..000000000 --- a/atomic/atomic_install.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -DEST="${HOST}${AUTOTEST_PATH}" -SRC="/usr/local/autotest/* /usr/local/autotest/.??*" - -echo -e "\nInstalling to $DEST" - -if [ -z "$HOST" ] -then - echo -e "\nAborting. HOST env. var is not set" - exit 4 -fi - -if [ -f "$DEST/client/autotest-local" ] -then - echo -e "\nWARNING: Existing $DEST renamed to ${DEST}.backup" - rm -rf "${DEST}.backup" - mv "$DEST" "${DEST}.backup" -fi - -mkdir "${DEST}" -if [ "$?" -ne 0 ]; then exit 1; fi - -echo -e "\nTransfering runtime to host..." -cp -a ${SRC} ${DEST} -if [ "$?" -ne 0 ]; then exit 1; fi - -# Reset to latest version or use tag -if echo -n "${IMAGE}" | grep -q ':' -then - ATD_IMAGE=$(echo "${IMAGE}" | cut -d: -f 1) - ATD_TAG=$(echo "${IMAGE}" | cut -d: -f2) -else # does not contain a tag, force latest - ATD_IMAGE=${IMAGE} - ATD_TAG="latest" -fi - -if [ -n "$SWITCH_VERSION" ] -then - ${AUTOTEST_PATH}/client/tests/docker/atomic/switch_version.sh $DEST $ATD_TAG - if [ "$?" -ne 0 ]; then exit 1; fi -fi - -if [ -n "$TESTS_CONFIG" ] -then - ${AUTOTEST_PATH}/client/tests/docker/atomic/tests_config.sh $DEST - if [ "$?" -ne 0 ]; then exit 1; fi -fi - -${AUTOTEST_PATH}/client/tests/docker/atomic/defaults_config.sh $DEST $ATD_IMAGE $ATD_TAG "$PROTECT_IMAGES" -if [ "$?" -ne 0 ]; then exit 1; fi - -${AUTOTEST_PATH}/client/tests/docker/atomic/control_config.sh $DEST -if [ "$?" -ne 0 ]; then exit 1; fi - -echo -e "\nExecute tests with: atomic run ${IMAGE}" -echo -e "or" -echo -e "${AUTOTEST_PATH}/client/autotest-local run docker" -echo -e "or" -echo -e "${AUTOTEST_PATH}/client/autotest-local run docker --args=names,of,tests,to,run" diff --git a/atomic/control_config.sh b/atomic/control_config.sh deleted file mode 100755 index 47b0aba71..000000000 --- a/atomic/control_config.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -if [ "$#" -lt "1" ] -then - echo "Usage $(basename $0): AUTOTEST_PATH" - exit 1 -fi - -AUTOTEST_PATH=$1 - -echo -e "\nSetting up Docker Autotest Control Configuration..." -cd $AUTOTEST_PATH/client/tests/docker - -if ! [ -f "config_custom/control.ini" ] -then - cp config_defaults/control.ini config_custom/ - if [ "$?" -ne 0 ]; then exit 1; fi -fi diff --git a/atomic/defaults_config.sh b/atomic/defaults_config.sh deleted file mode 100755 index 382a55b3b..000000000 --- a/atomic/defaults_config.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -if [ "$#" -lt "4" ] -then - echo "Usage $(basename $0): AUTOTEST_PATH ATD_IMAGE ATD_TAG PROTECT_IMAGES" - exit 1 -fi - -AUTOTEST_PATH=$1 -ATD_IMAGE=$2 -ATD_TAG=$3 -PROTECT_IMAGES=$4 - -echo -e "\nSetting up Docker Autotest Defaults Configuration..." -cd $AUTOTEST_PATH/client/tests/docker - -if ! [ -f "config_custom/defaults.ini" ] -then - echo "Creating 'config_custom/defaults.ini'" - DAEMON_PID=$(cat /run/docker.pid) - DAEMON_OPTIONS=$(cat /proc/${DAEMON_PID}/cmdline | tr '\000' ',' | cut -d, -f 2-) - sed -re " - s|daemon_options =.*|daemon_options = ${DAEMON_OPTIONS}| - s|docker_repo_name =.*|docker_repo_name = ${ATD_IMAGE}| - s|docker_repo_tag =.*|docker_repo_tag = ${ATD_TAG}| - s|docker_registry_host =.*|docker_registry_host =| - s|docker_registry_user =.*|docker_registry_user =| - s|^( +)ATOMIC_SUBSTITUTIONS|\1${IMAGE},\n\1${ATD_IMAGE}:${ATD_TAG},\n\1${PROTECT_IMAGES}| - s|preserve_cnames =.*|preserve_cnames = ${PROTECT_CONTAINERS}| - " config_defaults/defaults.ini > config_custom/defaults.ini - if [ "$?" -ne 0 ]; then exit 1; fi -fi diff --git a/atomic/switch_version.sh b/atomic/switch_version.sh deleted file mode 100755 index 76b3fb6aa..000000000 --- a/atomic/switch_version.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -if [ "$#" -lt "2" ] -then - echo "Usage $(basename $0): AUTOTEST_PATH VERSION" - exit 1 -fi - -AUTOTEST_PATH=$1 -VERSION=$2 - -echo -e "\nSwitching Docker Autotest to version $VERSION" -cd $AUTOTEST_PATH/client/tests/docker - -git reset --hard $VERSION &> /dev/null -if [ "$?" -ne 0 ] -then - echo -e "\nVersion not found, using latest" -fi - -cd ${AUTOTEST_PATH}/client -AUTOTEST_VERSION=$(tests/docker/atomic/config_value.py \ - DEFAULTS autotest_version \ - tests/docker/config_defaults/defaults.ini \ - tests/docker/config_custom/defaults.ini) -echo -e "\nSwitching Autotest to version $AUTOTEST_VERSION" -git reset --hard "$AUTOTEST_VERSION" diff --git a/atomic/tests_config.sh b/atomic/tests_config.sh deleted file mode 100755 index f465f7768..000000000 --- a/atomic/tests_config.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -if [ "$#" -lt "1" ] -then - echo "Usage $(basename $0): AUTOTEST_PATH" - exit 1 -fi - -AUTOTEST_PATH=$1 - -echo -e "\nSetting up Docker Autotest Test Configuration..." -cd $AUTOTEST_PATH/client/tests/docker - -if ! [ -f "config_custom/tests.ini" ] -then - echo "Creating 'config_custom/tests.ini'" - # All config files with an __example__ key are recommended for customization - for ini in $(grep --files-with-matches -r __example__ \ - --exclude defaults.ini \ - --exclude subtests/example.ini \ - config_defaults) - do - cat $ini - echo - done >> config_custom/tests.ini - if [ "$?" -ne 0 ]; then exit 1; fi -fi diff --git a/atomic/config_value.py b/config_value.py similarity index 78% rename from atomic/config_value.py rename to config_value.py index d6c6e289a..9113dadd7 100755 --- a/atomic/config_value.py +++ b/config_value.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +"""Simple utility to extract a value from a set of ini-files""" + import sys from ConfigParser import SafeConfigParser